In oxygenic photosynthesis, cyanobacteria and the chloroplasts of plants and algae turn carbon dioxide, water and photons into carbohydrates and free oxygen. Only some of this oxygen is used by the organism; the rest is released into the atmosphere.
From the perspective of the chloroplast, oxygen is waste. The carbon from carbon dioxide and the hydrogen from water are electrochemically combined into carbohydrates, and much of the oxygen is of no further use to the organism. When oxygenic photosynthesis first evolved 2 billion years ago, the result was a global catastrophe, as the new pollutant, diatomic oxygen, caused mass extinctions.
As semi-independent components of cells, chloroplasts are remarkably similar in both form and function. This has led to a widely supported theory that they stem from a common ancestor that incorporated itself into the cells of plants and algae in a symbiotic relationship, similar to mitochondria in humans. The cell provides water and protection to the chloroplast, and the chloroplast releases its energy-containing molecules into the cell.
While the pigment chlorophyll, which gives plants and green algae their color, is strongly associated with oxygenic photosynthesis, it is not necessary for it. Other pigments, such as carotenes and xanthophylls, are common in plants like wheat. Brown and red algae have their own pigments.