Oxygen is a by-product of the photosynthetic process.
The light-dependent reactions use H2O and produce O2.
CO2 is unusable until plants have "fixed" this carbon into sugar.
The water molecules are split to replenish electrons in photosystem II, leaving behind protons, which are used to generate a proton gradient for the formation of ATP, and oxygen, which is released as a by-product.
The NADPH produced by photosystem I is used to supply energy for the production of sugars during photosynthesis.
All organisms use the sugars produced by photosynthesis to generate energy.
Light energy drives the formation of ATP and NADPH during the light-dependent reactions; these energy molecules are then used during the light-independent reactions to form sugars.
The regeneration of RuBP ensures that the Calvin cycle can proceed indefinitely, since RuBP fixes carbon dioxide into an organic molecule that is used to produce sugar.