The primary function of mitochondria is to generate ATP, the energy currency of the cell. This is achieved through the process of oxidative phosphorylation, which occurs across the inner mitochondrial membrane. Glucose and other nutrients are broken down through metabolic pathways such as the Krebs cycle, and the electrons released are used by the electron transport chain to create a proton gradient, ultimately leading to ATP synthesis.