It emerged not with a quick flip of the switch but with a slow breaking of the dawn
In the book of Genesis, all God had to do was say the word. In modern cosmology, the creation of light took rather more effort. The familiar qualities of light—an electromagnetic wave, a stream of particles called photons, a source of information about the world—emerged in stages over the first millennia of cosmic history. In the very earliest moments, electromagnetism did not operate as an independent force but was interwoven with the weak nuclear force that governs radioactive decay. Those combined electroweak forces produced a phenomenon recognizable as light, but more complicated.
For instance, there was not one but two forms of ur-light, made up of particles known as B and W bosons. By 10–11 second, the universe had cooled enough for electromagnetism to make a clean break from the weak force, and the bosons reconfigured themselves to give rise to photons. The photons were thoroughly mixed in with material particles such as quarks. Together they formed an undifferentiated soup. Had you been alive, you would have seen a blinding, featureless glow all around you. Lacking color or brightness variations, it was as unilluminating as absolute darkness. The first objects with some internal structure did not emerge until 10 microseconds, when quarks agglomerated into protons and neutrons, and 10 milliseconds, when protons and neutrons began to form atomic nuclei. Only then did matter start to leave a distinctive imprint on light. At about 380,000 years, the soup broke up and light streamed across space in more or less straight lines. At last it could illuminate objects and form images. As this primordial light dimmed and reddened, the universe passed through a gloomy period known as the Dark Ages. Finally, at an age of 300 million years or so, the first stars lit up and the universe became able to generate new light. In Genesis, light emerged before matter, but in physics, the two emerged together.
Source of Information : Scientific American September 2009