Hydrocarbons are organics compounds which consist of only carbon and hydrogen elements. Common sources of hydrocarbons are natural gas, petroleum and coal. They are called fossil fuels. Fossil fuels originated from living things which died and were buried underground for hundreds of millions of years ago.
As plants and animals died, their remains settled on the ground on land and in swamps, lakes, and seas. Over time, layer upon layer of these remains accumulated. Eventually, the layers were buried so deeply that they were crushed by an enormous mass of earth. The weight of this earth pressing down on these plant and animal remains created intense heat and pressure. After millions of years of heat and pressure, the material in these layers turned into chemicals called hydrocarbons.
Hydrocarbons can be solid, liquid, or gaseous. The solid form is what we know as coal. The liquid form is petroleum, or crude oil. Natural gas is the gaseous form.