Proto-Solar Nebula
Early in the Sun's life, material left over from its formation
lied in an extended flat disk of planetary debris.
With time, much of this material collected near the Sun to form the Terrestrial planets (Mercury, Venus, Earth and Mars) with rocky surfaces. They contained lots of 'heavy elements'.
Further from the Sun, the Jovian Planets (Jupiter, Saturn, Uranus and Neptune) with very gaseous extended atmospheres, formed. These planets contain mostly H & He, like the Sun.
Additional debris, which did not find itself in planets, went into forming Astroids, Comets and the lesser (minor) planets, such as Pluto.
The formation of the planets was mostly completed in a few
hundred million years (perhaps even within 10 millions years). However, large amounts of debris continued
to slam into the planets for another billion years.
Presently, most debris in the inner solar system has been swept out.
(Lucky for us!)
Extra-Solar Planetary Disks
We see proto-solar systems around some stars when we block out
the very bright central star, like in Beta Pictoris shown here. This shows us that planetary systems
are not unique to our Sun. It was just a matter of time before
we would detect formed planets! By studying such systems around other stars, we
can study the formation and evolution of planetary systems.
(The star at the center has been blocked out so we can see the dimmer disk emission)