When life originated on Earth (~ 4 billion years ago), the atmosphere was composed of methane, CO2, and H2O vapour. Gaseous oxygen was absent since it had been consumed by combustion (or oxidation) before the Earth cooled. As the Earth colled, water collected in nutrient-rich pools. As life evolved some organisms learned how to use the sun's energy to synthesize large molecules from small molecules while others learned to use other sources of reducing power.
Joseph Priestly discovered that when he isolated a volume of air under an inverted jar, and burned a candle in it, the candle would burn out very quickly, much before it ran out of wax. He further discovered that a mouse could similarly "injure" air. He then showed that the air that had been "injured" by the candle and the mouse could be restored by a plant. In 1778, Jan Ingenhousz, repeated Priestly's experiments. He discovered that it was the influence of sun and light on the plant that could cause it to rescue a mouse in a matter of hours.
In 1796, Jean Senebier, showed that CO2 was the "fixed" or "injured" air and that it was taken up by plants in photosynthesis. Soon afterwards, Theodore de Saussure showed that the increase in mass of the plant as it grows could not be due only to uptake of CO2, but also to the incorporation of water.
Thus the basic reaction of photosynthesis was outlined:
CO2 + H2O + light energy --->(CH2O)n + O2
(CH2O)n = carbohydrate which leads to increased biomass
Early in the 20th Century, researchers took advantage of the use of isotopes to better understand the basic equation of photosynthesis. It was discovered that when carbon dioxide was labelled with a heavy isotope of oxygen, only the lighter isotope was emitted from the plant as oxygen gas. However, if the oxygen of the water was labelled, so was the oxygen gas emitted. This showed that the oxygen for photosynthesis was derived from the water.
Light energy entering the plant splits the water into hydrogen and oxygen:
2H2O + light energy --->O2 + 4H+ + 4 electrons
These electrons travel through an electron transport system in the chloroplast thylakoid mebrane much like the electrons in respiratory electron transport in mitochondria. The light energy that was put into the electrons used to pump protons through the thylakoid membrane and the proton gradient is used to synthesize ATP. In addition, the same electrons reduce NADP+ to NADPH, which serves as a carrier of reducting power. This reducing power is used to reduce carbon dioxide to the more complex carbon structure of carbohydrate.
The reactions leading to the production of ATP and reduction of NADP+ are called the light reactions because they are initiated by light energy. The reduction of carbon dioxide to carbohydrate, using the chemical energy produced by the light reactions, is governed by what has been termed the dark reactions.
The chloroplast is the organelle of photosynthesis. Chloroplasts

The chloroplast has three membranes: inner envelope, outer envelope, and thylakoid. It has three compartments: stroma, thylakoid lumen, and inter-membrane space. These compartments and the membranes that separate them serve to isolate different reactions of photosynthesis: Dark reactions take place in the stroma and light reactions take place on the thylakoid membrane.