Its all because of chemistry. When organics break down they have a couple possible things they turn into when decomposing. If oxygen is present, they will turn into C02 and water(H20), but ... if no oxygen is present ( like if they are buried under mountains of garbage, or in your unturned compost pile ) then your organics must resort to breaking down into methane (CH4)