A simplified version of the chemical formula for plant photosynthesis is:
CO2 + H20 + light energy -> CH2O + O2
light energy is visible light 380-750 nm
CH20 is actually a 3 carbon sugar in the form of a carbohydrate molecule here
O2 is a waste byproduct of photosynthesis
There aint no CO2 produced by trees or any plant life. CO2 is stored in the chloroplast until used and turned into a sugar. If the plant dies, as annuals or deforestation or whatever, stored CO2 can be returned to the atmosphere. But recognize that it only returns what it has taken. You can refer back to the Keeling curve and see the fluctuations between dieoff and rebirth. They balance out.