Did you know that plants and trees don't convert CO2 into oxygen at all? At the first and most well-known step in the feeding process of a plant, they convert sunlight into energy. You will probably have heard of this; this step is called photosynthesis. Plant leaves contain cells that convert sunlight into energy. Energy that plants then use to convert carbon dioxide (CO2) and water (H2O) into sugars. In this process a waste substance is released: Oxygen. This oxygen comes from the water molecule and not from the CO2, as is often said.
Plants also use oxygen
Because there is no sunlight at night, plants and trees use the sugars they have produced during the day. During this process, the sugars are converted back into CO2 and water. However, this also requires oxygen. You can compare it to a human who also breathes oxygen in and CO2 out again. Therefore plants also use oxygen but fortunately they produce up to 10 times more oxygen during the day than they consume during the night.