The moon's heavily cratered surface is the result of an intense pummeling by space rocks that took place between 4.1 billion and 3.8 billion years ago.
In all that time, the craters left behind by this barrage have hardly eroded at all, partly because the moon is not geologically very active, so earthquakes, volcanoes, and mountain-building don't destroy the landscape as they do on Earth; and also with virtually no atmosphere there is no wind or rain, so very little surface erosion occurs.