According to Genesis 1:3, "And G-d said, Let there be light; and there was light." What light is the Torah referring to if the sun which produces light by day was created only on the 4th day of creation?
The Gemara (Chagigah 12a) records a debate about this. One opinion (R' Elazar and R' Yaakov) is that the light referred to here is an intense light with special powers; G-d afterwards concealed it, realizing that there would be unworthy people who wouldn't deserve to make use of such light, and set it aside as part of the future reward of the righteous.
The other opinion (the majority view) is that the light created on the first day is the same as that we get from the sun and other heavenly bodies. The verse tells us G-d created them on the first day, and then placed them in their proper positions on the fourth day. (See also this question.)
You're assuming that the passage is only concerned with the creation of physical stuff, but verse 2 makes clear that everything was messed up chaos.
My opinion: Perhaps on day one, the laws of the universe were created: the existence of light, forces (e.g. gravity), matter, time etc. That's a faithful reading of the verse because it says 'Let there be light', not 'let there be a thing that produces light'.
Rabbeinu Bechaye explains that the light created on the 1st day was that of the sun itself but was not sufficient to provide light to the entire earth, which was only given on the 4th day. To support this he brings the posuk 17 which says: "And God set them in the firmament of the heaven to give light upon the earth", implying that at this point God gave them power to provide light upon all earth.
From a hard science background, I can tell you that Maxwell's laws of electromagnetism set up the initial conditions for light to not only exist, but also become mandatory.
G-d saying "let there be light" can from this perspective been seen as a metaphor for G-d inscribing the necessary laws of physics upon the space-time fabric so that light may occur. Then, since in physics everything which is optional is mandatory, light then had to appear because cause the conditions were now right for it's appearance.
(Slight correction: the description of our own space-time fabric itself includes Maxwell's equations. Therefore, when G-d created the universe by creating the space-time fabric with the laws we presently understand, light then automatically happened, because Maxwell's equations also describe the existence of light. Therefore, G-d spoke math, translating into more common terms as 'let there be light'. That's how I understand it.)
I'm aware that the following might sound too simplistic for those looking for more "scientific" answers but Rav Avigdor Miller repeated this question constantly in his lectures and he would give the following answer but with more depth. Hashem created the sunlight on the first day without creating the sun as the source for the light. It was only on the fourth day that He put the sun into place so that it would (appear) to be the source of the light. Of course, the way we see and know it, it is the sun that gives off the sunlight but Hashem was teaching us that really the sun is only hiding the truth which is that it is Hashem who is providing us with the light and the sun is doing it's (pretty good) job of hiding the fact that Hashem is the real source. Rav Miller spoke out this concept in more detail than I write here but it sounded very similar to way the Bal Hatanya explains the concept of Hashem Echad in Likutei Amarim (chapters 21-22)
this is on pshat level, the correct english tranlation is:
In the beginning (dot inside beit letter, is the abstract singularity of space-time), when God (blessed Supreme infinity/Divine Creator of Worlds) created the heavens (spiritual) and the earth (universe created with a big bang) and the universe was formless (unstructured/amorphous) and then structured (organized/arranged), darkness (primordial black holes/cosmic dark ages) was over the surface/space of the deep void of the universe(quantum fluctuations -> gravitational collapse), and a spirit of divine providence was hovering over the waters of the universe (Quark–gluon plasma filled the entire Universe , before matter/atoms was created).
And God said, Let there be light: and there was light.(and the universe transformed from dense/opaque screen/parsa, to transparent so photons can spread through)
other translation to ,And God said : Let there be light and Let there be [other] light (which then became darkness, universe's dark energy)
but on the level of secrets , this light gets a whole other meaning, or ha-ganuz... and tohu worlds, is a very deep concept