How is it that there could be light before the sun was made, or so it would seem? The problem arises because the creation account comes across as though the sun was not created until the fourth day (1:14-16), yet there was light on the first day (1:3). The solution to this Bible difficulty lies within today's study of God's Word.
Was Light Created on the First Day or the Fourth?(Genesis 1:1 and 1:16)—Did God Create or Make Light?
Light was created on the first day; the sun and moon were later appointed as light-bearers, revealing Jehovah’s orderly and purposeful creation.

