Craters on the moon are formed when rocks or comets from space smash into the surface of the moon with great force, pulverizing the ground and creating what we call regolith. The impact also sprays out material, creating ejecta rays that extend from the crater. The moon has no atmosphere, so even a tiny rock can create a crater. Typically, the size of the crater is much larger than the size of the rock that created it, depending on the amount of energy generated. There are hundreds of thousands of moon craters, and they are bowl-shaped landforms created by two processes: volcanism and cratering.
The Earth and the Moon have both been hit many times throughout their long 4.5 billion year history. However, Earth has processes that can erase almost all evidence of past impacts, such as erosion, tectonics, and volcanism. These processes break apart and wear down the ground, form new rocks, get rid of old rocks, and shift around over millions of years. As a result, very few rocks on Earth are as old as the rocks on the Moon. The Moon has not had tectonics for billions of years, so pretty much any tiny dent made on the Moon’s surface is going to stay there.
In summary, craters on the moon are formed by the impact of rocks or comets from space, which pulverize the ground and create ejecta rays. The moon has no atmosphere, so even a tiny rock can create a crater. Unlike Earth, the Moon has no processes that can erase almost all evidence of past impacts, so pretty much any tiny dent made on the Moon’s surface is going to stay there.