The creation account in Genesis had a glorious beginning as God called light into existence on the morning of the first day.
However, this poses a problem. Where did the light come from? The sun and stars were not formed until day four.
The definitive answer to this question is that the text does not say. However, in the context there are only three things that exist in those dark moments before the first morning: the eternal God, the newly created heavens, and the newly created earth. The light must have originated from one of these.
Did the Light Proceed from God?
John 1:5 tells us that God is light without any darkness. Thus, the light of the first day could have come from God himself. Revelation 21:23-25 describes God being the light of the New Jerusalem and there will be no need of sun or moon. So, did the light proceed directly from God?
Three issues in the context contradict God being the source of this light. First, the above passages tell us that there will be no darkness and no night when the light comes from God. However, in Genesis there is night and it was dark even with God's presence. Genesis 1:2 says that darkness was over the face of the deep and the Spirit of God was hovering over the face of the waters. Second, God called this earthly light into existence. He said, "Let there be light, and there was light." The light of God does not need to be turned on. It is a part of His eternal nature. Third, there is no transition described in the account from God light to Sun light. Thus, while God is light, that does not seem to be the type of light described in the creation account.
Did the Heavens Produce Light?
What are the heavens? The English word 'heavens' would include stars, but the original Hebrew word 'shamayim' never means stars in the Bible. It means space. It is what God stretched out on day two. It is where the sun, moon, and stars were placed on day four. While space transmits light, we have never observed space, itself, producing light. Thus, this is an unlikely source of light for the first day.
Did the Earth Produce Light?
While today, the most common meaning of 'earth' is Planet Earth, Genesis 1:1 seems to be describing material earth (land/soil). That was exactly what John Wycliffe had in mind when he translated the first English Bible in the 1300's. Wycliffe translated the Hebrew word 'erets' as 'earth', the place where he planted his seeds (land, soil, material earth). At that time in history, earth rarely, if ever, meant Planet Earth. However, word meanings change over time. Today 'earth' commonly means Planet Earth, but that is not the 'earth' Genesis 1:1 is describing. This material earth was watery (liquid), and on day two God spread it out to the vast expanse of the universe. On day three He used some of it to form Planet Earth, and on day four He used the rest of it to make the Sun, moon, and stars. Note that the Bible does not say that the sun and stars were created out of nothing. Rather they were made (Hebrew 'asah') which indicates being formed and fashioned from existing material. Thus, it seems that the entire material of the universe was created on day one, spread out on day two, and used to make every physical thing in the following days. If this material could be used to make the sun and stars, it certainly could produce light.
Again, while the text has no definite answer to this issue, it seems to me that the surface of the earth material (all the matter in the universe) was ignited on day one. That would have been a morning like no other. The earth material of the whole universe was in one blob, and God lit it. Then on day two God spread the earth material out into the vast expanse of space. This began the normal day/night cycle. One side of the earth-material blob that would become Planet Earth was illuminated by shining blobs of earth material that would become the sun. The other side of Planet Earth was dark because it shaded itself from the light.
On day three God formed one blob of earth material into Planet Earth including the land, ocean, and plants. On day four He took all the blobs of earth material that He had spread throughout the expanse of space and formed them into the sun, moon, and stars. He made them the correct size and placed them in the proper places.
The definitive answer is that the text does not say where the first light originated. However, all light today originates from matter (earth material), and that is exactly what God created in the moments before the first day. It seems logical that the first light came from earth material.
For further clarification, read a modern, literal translation of Genesis 1.