Water is the molecule split to release oxygen in photosynthesis.
The splitting occurs during the light-dependent reactions inside the thylakoid membranes of chloroplasts. In Photosystem II, light energy drives the oxidation of two water molecules, producing four electrons, four hydrogen ions, and one molecule of oxygen gas. The electrons replace those lost by chlorophyll, while the hydrogen ions help build the gradient used to make ATP.
This process is called photolysis, or photosynthetic water splitting. It is catalyzed by the oxygen-evolving complex, a metal cluster containing manganese and calcium. The oxygen released by plants is therefore derived from water, not from the carbon dioxide used to build sugars.
A common mix-up is to credit chlorophyll with producing oxygen. Chlorophyll captures light energy, but it is the water-splitting machinery associated with Photosystem II that supplies the oxygen. Oxygenic photosynthesis in plants, algae, and cyanobacteria uses water; some other photosynthetic microbes perform anoxygenic photosynthesis and release substances such as sulfur instead.