All living things needs energy to live, some of them uses the sun's energy (through photosynthesis), and some of them get energy through eating other living things, in order to get carbon-based substances that store chemical potential energy. When those living things die, they may collect in layers at the bottoms of lakes or oceans and overtime layers become buried, and under the effect of temperature and pressure the chemicals in these thngs turn into hydrocarbon deposit, which we regard as fossil fuels.
Since fossil fuels are technically hydrocarbon, carbon dioxide is formed after burning fossil fuels. Meanwhile, we burn lots of them all the time, so burning fossil fuels is one of the major causes of Green House Effect problems.
Now fossil fuels account for about 90% of all energy consumed by industrial nations, and eventually they will be used up, since fossil fuel takes a long time to form, not immediately forms after something dies. So scientiests are now looking for alternative energy sources such as nuclear power, hydroelectric power, etc.