The solar system began forming about 4.5 billion years ago.
The solar system starting point was a huge cloud of interstellar gas and dust "solar nebula" made up of mostly hydrogen and helium. (98%)
The cloud started to collapsing under its own gravity; over 1,000 years. Causing it to form an Accretion disk.
The Accretion disk cause a protostar to form. A protostar is forms in the center, when the core becomes opaque; later will become the Sun.
Accretion disk causes the matter around the center spins up and flattens into a disk, while heat vaporizes the dust.
When the condensation is happening it cause an Planetesimals this accretion goes on until the particles become the size of boulders or small asteroids, which attract matter with their gravity.
Protostar cause an condensation The disk radiates away its energy and cools off; some gas condenses into tiny dust grains of metal.
After proplanets started to form solar winds started to happen causes gravity to pull in the surrounding gas, and becomes gas giant
When Planetesimals was happening Proplanets started to form. Proplanets is The larger particles' growth accelerates, and they accumulate all of the solid matter close to their own orbit
The finally thing that happened is Fragmentation while larger planetesimals become more massive, smaller ones break into smaller pieces when they collide, end up as meteorites on larger objects, and/or their orbits are altered.