Consider something unbelievably tiny, unbelievably dense, and incredibly hot. Then, suddenly, space, time, and all molecular matter burst in ways that no words can express. What is known is that the Universe expanded at an unfathomable rate in a fraction of a second. Some recognised subatomic particles and fundamental forces emerged as a result of this expansion. The Universe then began to cool drastically, to around 1 billion degrees Celsius, allowing energy and ultimately matter (plasma of nuclei, electron and photons) to emerge.
As the universe expanded, plasma grew cooler and cooler. The universe cooled down further to 3000 K, making it possible for the nuclei in the plasma to gain electrons and become full-fledged neutral Hydrogen and Helium atoms.
Photons of light tangled in the plasma could now move freely and were released. The universe became transparent for the first time. This is known as cosmic microwave background that we can see even today.
The entire universe was made up of Hydrogen and helium gas clouds with no stars and planets.
After the release of CMB, nothing in the Universe radiated light until around 200 million years after the Big Bang when the first stars began to form.
Due to gravity, hydrogen and helium clouds began to clump together. Tiny imperfections. Little knots, wrinkles, and flaws began attracting nearby particles of matter. The clumps grew, became more massive, and attracted more particles. Hence, it made them denser, and as a result, gravity became more intense. As the clouds compress more and more, they became hotter, until the center became so hot that nuclear fusion began. This released a tremendous amount of energy, which caused the earliest stars to light up. The gravity that was trying to squash the star together was pushed back by the fusion at the center which created a balance. Within a few hundred million years after the Big Bang, the first generation of stars, known as Population III stars, were formed. After CMB, these stars were the first source of visible light in the universe.
Stars formation happened almost everywhere in universe. Thus we have billions and billions of stars. Galaxies were formed out of these swirling clouds of stars and gas in space. Gravity sends these objects careening into one another as other clouds approached, knitting them into larger spinning packs. Material can be slung toward a galaxy's outskirts following collisions, forming large spiral arms filled with star colonies. Since, these were large scale structure it took a long time in an almost homogeneous gas clouds.