Millions of years ago, the remains of plants and animals decayed and built up in thick layers.  This decayed matter from plants and animals is called organic material -- it was once alive.  Over time, the mud and soil changed to rock, covered the organic material and trapped it beneath the rock.  Pressure and heat changed some of this organic material into Coal, some into Oil (Petroleum), and some into Natural Gas -- tiny bubbles of odorless gas.  The main ingredient in natural gas is Methane, a gas (or compound) composed of one Carbon atom and four hydrogen atoms.

In some places, gas escapes from small gaps in the rocks into the air; then, if there is enough activation energy from lightning or a fire, it burns.  When people first saw the flames, they experimented with them and learned they could use them for heat and light.