Petroleum formed hundreds of millions of years ago, from the remains of prehistoric creatures. No, not dinosaurs—microscopic plants, and the tiny animals that fed on them. Just as they do today, the plants harvested energy from sunlight and used it to combine carbon, hydrogen and oxygen into high-energy compounds like sugars. This process is called “photosynthesis,” which means “building with light.” As a result of photosynthesis, the energy from the sunlight was actually stored in the chemical bonds of these organic compounds.
These tiny prehistoric plants and animals were constantly dying and sinking to the sea or lake bottom. If they settled where there were few bacteria to break them down, and very little oxygen to react with them, the organic compounds would collect and become buried by sediment before they could decay. As they became buried, temperatures and pressure rose, and the water and carbon dioxide within the mixture was squeezed and cooked out, leaving behind a waxy substance called kerogen. It was made of long chains of carbon and hydrogen, with just a little oxygen, nitrogen and sulfur.
Over many millions of years, more and more sediment settled over these deposits, until they were buried over four kilometers deep. Under these high temperature conditions, the kerogen underwent a process called catagenesis, or cracking. This formed shorter chain compounds of mostly hydrogen and carbon, which are called—you guessed it—hydrocarbons. And it is the mixture of these hydrocarbons that we call petroleum. The higher the temperature, the shorter the chains that were formed. At really high temperatures, the result was methane, or natural gas, with just a single carbon atom and four hydrogen atoms.
Petroleum is lighter than the water that filled gaps in the deep rocks, so it squeezed and bubbled its way upward towards the surface of the earth. Some of the petroleum made its way all the way to the surface, where much of it was broken down by bacteria or evaporated away. But some of it got trapped under non-porous rock, and formed underground deposits. Geologists look for the sorts of rock that tend to form these deposits, so that oil companies can drill there and pump out the petroleum.
The thing that makes these hydrocarbons useful is that when they combine with oxygen, they release the original energy that the tiny plants stored in their chemical bonds. The technical terms for this reaction are oxidation or combustion. But most people call it burning.
The energy that’s released can heat a house, run a car or power a jet plane.