Plants take in CO2. They keep the carbon and give away the oxygen. Animals breathe in oxygen and breathe out carbon dioxide.
Plants and animals depend on each other. It works out well. For hundreds of millions of years, plants and animals have lived and died. Their remains have gotten buried deep beneath Earth's surface. So for hundreds of millions of years, this material has been getting squished and cooked by lots of pressure and heat.
So what happens to all this dead plant and animal stuff? It turns into what we call fossil fuels: oil, coal, and natural gas. This is the stuff we now use to energize our world. We burn these carbon-rich materials in cars, trucks, planes, trains, power plants, heaters, speed boats, barbecues, and many other things that require energy.