Like the floor of a teenager’s room, cities tend to pile up over time.
There is a survivorship bias at work here: buildings and monuments left exposed on the surface don’t last very long. Humans steal the best bits to reuse in other buildings, and erosion wears everything else to dust. So the only ancient ruins we find are the ones that were buried.
But they got buried in the first place because the ground level of ancient cities tended to steadily rise. Settlements constantly imported food and building materials for the population, but getting rid of waste and rubbish was a much lower priority. New houses were built on top of the ruins of old ones because hauling away rubble was labour intensive and it was much easier to simply spread it out and build straight on top.
Rivers periodically flooded and added a layer of silt, while in dry regions the wind was constantly blowing in sand and dust. (The Sphinx was buried up to its head in sand until archaeologists re-excavated it in 1817.)
When ancient towns were abandoned entirely, plant seeds quickly took root and created more bulk from the CO2 they pulled from the air. Their roots stabilised the soil created from rotting plant matter and the layers gradually built up.
Archeologists are always digging up ancient ruins. How did all of these ruins get buried in the first place?
It all depends on the environment. In southern Ontario, where I’ve done a lot of work, the typical topsoil is on average about 20-30cm thick, and that’s where all the archaeological materials are. Below that is the strata that was deposited when the glaciers were still around, so that 30cm of topsoil represents about 13,000 years. That’s very slow, and is mostly the result of leafs and plants dying every year and gradually accumulating and turning to soil. The people living there would have lived in houses made of wood, which rots, and then their artifacts are scattered everywhere around the site. In time, the new soil accumulates over top of it and after a long period of time, things get buried. But on a floodplain, soil accumulates a lot more quickly because a river carries a lot of sediment but when it floods the water is stagnant in the flooded areas and the sediment settles to the bottom and accumulates. And floods like this happen every few years, so after 1000 years you can get a few meters of soil on top of the site.
The other place where I work is in the coastal deserts of Peru. The sites there are very much still above ground, but walls and parts of them are buried. The typical coastal site was probably built on a sand dune to begin with and eventually became a town or city with walls and large mounds and all sorts of things. But these dunes were formed by blowing sand and after the site was abandoned the sand kept blowing, so they’re covered by sand that simply blew in. I’ve excavated a room, left it for a week as we moved onto another one, and that first room was almost entirely buried again just from the blowing sand, and that’s in a desert where there is no organic soil accumulation, unlike what I described for Ontario. And when people were living there they knocked down walls to build new houses and leveled off the area by dumping sand, ash and bones from kitchen fires, etc. and this also buries things. And these are just two examples; there are all sorts of cultural and natural processes that bury things.
But a lot of archaeology is not buried at all. Machu Picchu did not have to be excavated; all the ruins sit above ground. They were covered with forest growth and that had to be cut away, but the site is not that old and there has not been enough time to cover everything. There are some excavations because things lying on the ground have become covered by what soil accumulation there is (in places) plus the cultural processes that lead to burial (e.g. graves, building things in different stages, etc.) But in places where there is little soil accumulation, like back in the coastal deserts of Peru, you actually find artifacts lying out on the surface of sites. Lots is buried too, but artifacts sit on the surface too.