Photosynthesis occurs to furnish life, directly or indirectly, with chemical energy in organisms.
Plants use photosynthesis as a means of obtaining energy from sunlight.
These energy packets are, in turn, used with carbon dioxide to build a variety of chemicals in the plant, including carbohydrates, fats and proteins - the common compounds we call food. When we eat plants as food, we break down, or metabolize, food compounds to small molecules. Some of these molecules are used to build more complex structures, such as bones and muscles in every part of our bodies. Other metabolites are used to produce the energy packets, such as ATP, needed to put together those complex structures. The creation of ATP in animals requires oxygen and produces carbon dioxide, just the opposite of photosynthesis, which uses carbon dioxide and produces oxygen.