Vegetation consumes CO2 and produces O2 during daylight hours. But, at night, vegetation consumes O2 and produces CO2.
By the way, even though CO2 (carbon dioxide) is the most famous greenhouse gas, it is not the only one, nor is it the worst, actually. Water vapour is also a greenhouse gas...