Caves are formed when rainwater, acidified by carbon dioxide in the soil, seeped downward through millions of tiny cracks and crevices in the limestone layers. This weak carbonic acid (the same acid as in soda pop) dissolved a network of tiny microcaverns along cracks. If the bedrock is lifted, the erosion will create deeper channels. Just as rivulets converged into streams above ground, water flow paths through the limestone also converged into incrementally larger flow paths.
As rainwater continued to enter the system and more limestone was dissolved, the microcaverns enlarged. Because the major drains carried the most water, they enlarged the most. Caves were forming. If the water table continues dropping new underground drains formed at levels lower than the older ones, and the older channels empty. Thus the oldest cave passages are the closest to the surface, and the youngest horizontal passages are the deepest underground.