In the ocean, the remains of dead organisms sink, and are buried. Over millions of years the soft parts turn into oil and natural gas. The vegetation gets buried in warm swamps, turning to coal. In this way, carbon dioxide from the air ends up in as fossil fuels, and when burned, released once again.