Meanwhile, the rest of the solar nebulae had flattened out into a spinning disk. You can see the edge of the disk in the right edge of this picture.
The gas and dust in the disk coalesced into tiny clumps known as planetesimals. These planetesimals stuck to each other and turned into planets and asteroids.
There's a mathematical formula which predicts, with high accuracy, what the radius of each planet's orbit around the sun is. However, it also predicts that there should be a planet where the asteroid belt now is. Because of this, scientists used to think that there had been a planet there and it has somehow been destroyed. However, scientists now believe that Jupiter's huge gravity simply prevented the planetesimals in that orbit from ever forming into a planet, and they formed into a lot of smaller clumps -- the asteroids.