The Solar System is believed to have formed according to the nebular hypothesis around 4500 million years ago. The Solar System formed when a giant molecular cloud of gas and dust, a nebula, collapsed - possibly when it was hit by a shockwave from a nearby exploding star, a supernova.During collapse the material formed a rotating disc and matter was drawn towards the centre where it became dense and immensly hot. In the very centre of the disc the heat triggered nuclear reactions in the form of fusion which resulted in the formation of the Sun.It would have taken as little as 50 million years for the Sun to form. Once it did so the solar wind (stream of charged particles being ejected by the violent nuclear reactions within the Sun) would have 'blown' the lighter gases further out to an area called the snow line.At the snow line collisions between the light non-metallic particles were more successful than those going on closer to the sun and so the Gas Giants formed rapidly by a process called accretion.The large, newly formed Gas Giants sweep the asteroid belt ejecting and consuming the football sized accretions, this reduced the friction and promoted the terrestrial planets to form.Once the new planets are large enough they begin to differentiate, a process where they divide into layers. The dense metallic elements, iron, nickle etc sinking to the core leaving the lighter silicon, oxygen, aluminium etc to form the crust and mantle.The Asteroid belt has been prevented from accreting effectively by the destabilising gravity of the Jovian planets, thus the size of these bodies is very limited and they will never form a planet.