The strong gravitational force of the planet Jupiter shepherds the asteroid belt, pulling the asteroids away from the Sun, keeping them from careening into the inner planets. For example, an orbit in which an asteroid orbited the Sun exactly three times for each Jovian orbit would experience great gravitational forces each orbit, and would soon be pulled out of that orbit. The Kirkwood gaps are named for Daniel Kirkwood who discovered them in 1866. About 3,000 asteroids have been cataloged. There are many more smaller asteroids.
Some asteroids even have orbiting moons.
The asteroid 243 Ida and its tiny asteroid moon, Dactyl. This is the first asteroid ever found with an orbiting moon. Asteroids can be pulled out of their solar orbit by the gravitational pull of a planet. They would then orbit that planet instead of orbiting the Sun. Astronomers theorize that the two moons of Mars , Phobos and Deimos, are captured asteroids.