According to the American Petroleum Institute, oil or petroleum is a naturally occurring liquid derived from ancient fossilized organic matter. This fossil fuel is found in geological formations beneath the Earth's surface.
Millions of years ago, organic material such as zooplankton and algae settled to sea or lake bottoms, and mixed with sediments. The organic material was eventually cut off from oxygen, and intense heat and pressure built up in these lower regions. This process caused the organic material to decompose into liquid and gaseous hydrocarbons.
Petroleum formed in regions where the liquid hydrocarbons became trapped under layers of impermeable rock, called source rock. Over time, the hydrocarbon liquid cooked into oil reservoirs sealed under this source rock. These trapped reservoirs are where oil is found today. Wells are drilled into the source rock, and the oil is pumped out for refinement.