Plants make their own food out of inorganic compounds through a process called photosynthesis that takes place in the leaves. The ingredients necessary for photosynthesis are light, water and carbon dioxide. The rate of photosynthesis will be affected by the amount of these ingredients available, as well as the temperature. The end products of photosynthesis are oxygen, which the plants release, and carbohydrates, which become the plants' source of energy. Building on the basic structure of glucose, plants also use photosynthesis to create several more complex carbon-based chemicals essential to their growth and survival.
First, water absorbed through the roots rises to the leaves and enters special cells called chloroplasts. These cells contain chlorophyll, a green pigment that gives leaves their color by reflecting green wavelengths. More importantly, chlorophyll absorbs light in the red and blue parts of the spectrum and uses it to power a crucial chemical reaction. Inside the chloroplast, chlorophyll molecules absorb a single photon of light and in exchange for an electron. A series of chemical reactions follows, which ultimately replaces the lost electron from water molecules in the leaf. In the process, the oxygen atom in the water separates from the hydrogen atoms and passes out as waste. The remaining hydrogen is collected and eventually synthesized into a carbohydrate molecule.
The process that creates the actual food for the plant does not require light, so it's called a dark reaction. In another part of the leaf called the stroma, carbon dioxide that's been absorbed from the environment is reduced into carbon and oxygen. Again, the oxygen is allowed to escape, but the carbon combines with the hydrogen end product of the first process to form a simple sugar. These can be combined or modified to produce almost any organic compound the plant might need, whether for structure or nutrition.