Limestone is a type of sedimentary rock that is composed largely of calcium carbonate (CaCO3). Calcium carbonate can dissolve in acidic water, so groundwater that has picked up a slight natural acidity over time will seep into the limestone and start to dissolve away the rock and create void space in its place. Over a long period of time these void spaces become large caves. Such cave types are called solutional caves and limestone caves are among the most common on the planet. The stalactites and stalagmites that form are caused by the dissolved calcium carbonate precipitating from the water in interesting formations. You use the term fast in your question but really this whole process is very slow, taking place on a geological time scale (millions of years).