The trick is that gravity is based on mass and distance. In the asteroid belt, the planets are so far away that their gravitational influence is very weak. Asteroids have much less mass, but since they are much closer, they exert the largest attraction in the neighborhood, and start orbiting each other.
thanks, good explanation