Oxygen is released as a waste product. Carbon is fixated during the Calvin cycle. This carbon is converted into energy that the plants take in, releasing oxygen as the waste product which is what we take in.
Note: this is a very complicated process and it requires a deeper understanding like knowing the cyclic and noncyclic photophorylation reactions in the light dependent reactions which produce atp and the entire Calvin cycle (light independent reactions) to fully answer your question. I have given you a very basic answer and super oversimplified it. I just wanted to let you know this Bc there is a lot more going on that just what I have listed above