Photosynthesis is the process by which plants and other autotrophs convert sunlight, carbon dioxide, and water into oxygen and energy-rich organic compounds like glucose. It occurs in chloroplasts through two stages - the light reactions absorb sunlight and produce ATP and NADPH using pigments like chlorophyll, while the dark reactions use these products to fix carbon and produce sugars. Oxygen is released as a byproduct of the light-dependent process in the thylakoid membranes of chloroplasts.