How did the Solar System's planets come to be? The leading theory is something known as the "protoplanet hypothesis", which essentially says that very small objects stuck to each other and grew bigger and bigger—big enough to even form the gas giants, such as Jupiter.
But how the heck did that happen? More details below.
Birthing the Sun
About 4.6 billion years ago, as the theory goes, the location of today's Solar System was nothing more than a loose collection of gas and dust—what we call a nebula. (Orion's Nebula is one of the most famous examples you can see in the night sky.)
Then something happened that triggered a pressure change in the center of the cloud, scientists say. Perhaps it was a supernova exploding nearby, or a passing star changing the gravity. Whatever the change, however, the cloud collapsed and created a disc of material, according to NASA.
The center of this disc saw a great increase in pressure that eventually was so powerful that hydrogen atoms loosely floating in the cloud began to come into contact. Eventually, they fused and produced helium, kickstarting the formation of the Sun.
The Sun was a hungry youngster—it ate up 99% of what was swirling around, NASA says—but this still left 1% of the disc available for other things. And this is where planet formation began.
Time of chaos
The Solar System was a really messy place at this time, with gas and dust and debris floating around. But planet formation appears to have happened relatively rapidly. Small bits of dust and gas began to clump together. The young Sun pushed much of the gas out to the outer Solar System and its heat evaporated any ice that was nearby.
Over time, this left rockier planets closer to the Sun and gas giants that were further away. But about four billion or so years ago, an event called the "late heavy bombardment" resulted in small bodies pelting the bigger members of the Solar System. We almost lost the Earth when a Mars-sized object crashed into it, as the theory goes.
What caused this is still under investigation, but some scientists believe it was because the gas giants were moving around and perturbing smaller bodies at the fringe of the Solar System. At any rate, in simple terms, the clumping together of protoplanets (planets in formation) eventually formed the planets.
We can still see leftovers of this process everywhere in the Solar System. There is an asteroid belt between Mars and Jupiter that perhaps would have coalesced into a planet had Jupiter's gravity not been so strong. And we also have comets and asteroids that are sometimes considered referred to as "building blocks" of our Solar System.
We've described in detail what happened in our own Solar System, but the important takeaway is that many of these processes are at work in other places. So when we speak about exoplanet systems—planets beyond our Solar System—it is believed that a similar sequence of events took place. But how similar is still being learned.
Making the case
One major challenge to this theory, of course, is no one (that we know of!) was recording the early history of the Solar System. That's because the Earth wasn't even formed yet, so it was impossible for any life—let alone intelligent life—to keep track of what was happening to the planets around us.
There are two major ways astronomers get around this problem. The first is simple observation. Using powerful telescopes such as the Atacama Large Millimeter/submillimeter Array (ALMA), astronomers can actually observe dusty discs around young planets. So we have numerous examples of stars with planets being born around them.
The second is using modelling. To test their observational hypotheses, astronomers run computer modelling to see if (mathematically speaking) the ideas work out. Often they will try to use different conditions during the simulation, such as perhaps a passing star triggering changes in the dust cloud. If the model holds after many runs and under several conditions, it's more likely to be true.
That said, there still are some complications. We can't use modelling yet to exactly predict how the planets of the Solar System ended up where they were. Also, in fine detail our Solar System is kind of a messy place, with phenomena such as asteroids with moons.
And we need to have a better understanding of external factors that could affect planet formation, such as supernovae (explosions of old, massive stars.) But the protoplanet hypothesis is the best we've got—at least for now.
Explore further: Solar system simulation reveals planetary mystery