The Solar System was formed from a large. rotating cloud of interstellar dust and gas called the solar nebula.
Hit by a shock wave from a nearby supernova, a large. rotating cloud of interstellar dust began to rotate. As the cloud began to accelerate, it flattened it into a disk centering its axis of rotation.
The sun is formed
The matter in the center compressed and heated and the star now known as our sun ignited.
The Planets are formed
Chaos caused small collisions to form into clumps of stardust with successively larger fragments of dust and debris clumped together to form the planets.
A last a great solar wind emanating from the the newly formed sun cleared out the material in the disk that had not already condensed into the planets.