Astronomers believe that the entire Solar System formed out of a cloud of gas and dust 4.6 billion years ago. This giant molecular cloud is known as the solar nebula.
More than 4.6 billion years ago, there wasn’t a Solar System. Instead, there was only a cloud of cold molecular gas and dust light years across. Some event, like a nearby supernova explosion, caused the solar nebula to collapse, creating regions of higher density. In this dense regions gravity took over, pulling material inward into dense pockets where stars would eventually form.
In just one of these regions of the solar nebula is where our entire Solar System began to form. As the nebula collapsed it began to spin up, conserving the momentum of all the individual atoms in the cloud. Most of the material collected together into a ball in the center, but some spun out into a flattened disk around the newly forming Sun. At the earliest stage, the Sun was probably a T Tauri star – a class of protostars that we see in other nebulae. But after 50 million years or so, the temperature and pressures were enough to ignite fusion in the core of the Sun.
The planets formed out of the disk of material orbiting the young Sun. They started out as tiny particles of dust which gathered together over time to form larger and larger objects. They collided to form rocks, and then boulders, and eventually dwarf planets. These dwarf planets collided together to eventually form the planets in the Solar System that we see today.
Although all traces of the solar nebula are gone today, astronomers can use their telescopes to see other star systems at various stages of development, from cold molecular clouds, to nebulae with stars just starting to form in dense pockets in the dust. Astronomers have even imaged the protoplanetary disks of gas and material circling distant stars. And in a few million years, they’ll be planets and stars too, born out of a solar nebula.
Here’s an article from Universe Today that describes how the solar nebula probably lasted 2 million years, and another article about how the Sun started shining early on after the solar nebula collapsed.
We have recorded an episode of Astronomy Cast just about the Sun called The Sun, Spots and All.
NASA: Birth of Worlds