Sediments containing lots of calcium carbonate from shells can be turned into rock over millions of years. This limestone rock can be pushed up to form land by tectonic Earth movements. Some carbon trapped in the sediments forms gas and oil.
Acknowledgement: Verity Coomer