Photosynthesis is a process that uses the light energy to convert the raw materials such as the CO₂ and H₂O and convert it to carbohydrates.
Here the water acts as an oxygen donor.
The CO₂ gets reduced to form the carbohydrate and water gets oxidised to form oxygen.
Here, the oxygen is a waste material because it is not involved in the synthesis of the food material i.e the glucose. It is of no use to the plant thus a waste material.