One major theory for the evolution of the asteroid belt is that planetesimals (early precursors to planets) formed early in the development of the Solar System in Solar orbits around the asteroid belt. These planetesimals had enough internal gravity and heat to form rocks. From wikipedia:
Planetesimals within the region that would become the asteroid belt
were too strongly perturbed by Jupiter's gravity to form a planet.
Instead, they continued to orbit the Sun as before, occasionally
colliding.[37] In regions where the average velocity of the collisions
was too high, the shattering of planetesimals tended to dominate over
accretion,[38] preventing the formation of planet-sized bodies.
Here on Earth, we get boulders from rock layers being broken up by geological processes like glaciation, earthquakes, erosion, etc... In the asteroid belt, the boulders and smaller debris (according to this theory) was formed from collisions breaking up planetesimals. Collisions increased the number of fragments in these orbits, causing a runaway process which filled the region with debris of various sizes. After sufficient material was ejected from these orbits, collisions would begin to decline, allowing boulder piles to come back together to form loose asteroids.
As an interesting aside, NASA scientist Don Kessler hypothesized that something similar may happen with human artificial satellites in Earth orbits. From his seminal paper abstract Kessler and Cour-Palais 1978:
As the number of artificial satellites in earth orbit increases, the
probability of collisions between satellites also increases. Satellite
collisions would produce orbiting fragments, each of which would
increase the probability of further collisions, leading to the growth
of a belt of debris around the earth. This process parallels certain
theories concerning the growth of the asteroid belt.
This process is now known as the Kessler syndrome, or collisional cascading.