Photosynthesis takes place in small organelles called chloroplasts, which reside in some plant cells. Most photosynthetic cells are in the leaves of a plant, though a few may be found in other structures.
During photosynthesis, the chloroplasts absorb the energy from the sun's rays. By combining the absorbed energy with carbon dioxide and water, the plants can produce sugars. Sugars store energy in their chemical bonds, allowing the plants to harvest energy from the sun and store it until they need it. Chloroplasts also produce oxygen as a by-product of the process. Oxygen is a waste product for plants, and they expel it through structures called stoma, which are most abundant on the undersides of leaves.
Chloroplasts only occur in the cells of plants and protists. However, animal cells have roughly analogous organelles, called mitochondria. Both organelles are involved in metabolic functions and produce or store energy for the cells. Both mitochondria and chloroplasts have their own DNA, and they likely evolved from free-living bacteria. Over time, both have evolved to live symbiotically inside the cells of multicellular organisms. In exchange for a safe, nutrient rich home, chloroplasts and mitochondria produce energy that allows the larger organisms' cells to function.