Petroleum is a fossil fuel which is also called as crude oil.
It was formed by the decomposition of organic matter over millions of years.
Petroleum is formed when large quantities of dead organisms primarily zooplankton and algae–underneath sedimentary rock, plants and animals that lived in shallow seas were mixed with other sediments and then, were subjected to intense heat and pressure.
The remains of these organisms that were compressed under high pressure & temperature, their fat content and water were transformed into fossil fuels.
Coal, natural gas, and petroleum are all fossil fuels that were formed under similar conditions.