How is CO2 gas produced?

By the trees breathing. lol the leaves take in CO2 and release O2. Also burning of fossil fuels etc..