It could be explained pages about, but to do it it is already Wikipedia, so basically:
It is a
fossil fuel formed when large quantities of dead organisms, usually
zooplankton and
algae, are buried underneath
sedimentary rock (which were sediments at first) and undergo intense heat and pressure.
When tiny organisms die, they sink to the bottom of the sea and are
mixed with mud and silt. Over time, hundreds of feet of mud containing
the organisms accumulate. Bacteria removes most of the oxygen, nitrogen,
phosphorus, and sulfur, leaving mainly hydrogen and carbon. Lack of
oxygen keeps the animals and plants from decaying completely. The
partially decomposed organisms create a slimy mass, which is then
covered with layers of sediments. Over millions of years, many layers of
sediment pile on top of the once-living organisms. The weight of the
sediment compresses the mud into a fraction of its original thickness.
When the depth of burial reaches about 10,000 feet, heat, time and
pressure turn the organisms into different types of petroleum.
Article Source: http://EzineArticles.com/786475