During photosynthesis, plants take in carbon dioxide and water, and using sunlight energy, produce glucose and release oxygen. The oxygen released comes from the water molecules (H2O), not CO2. This is why plants are called oxygen factories - they replenish atmospheric oxygen.