NADH is produced in the citric acid cycle, which is a series of chemical reactions that convert glucose into carbon dioxide and water. During the citric acid cycle, NADH is formed when two hydrogen atoms are transferred from a molecule of glucose to a molecule of NAD+ (nicotinamide adenine dinucleotide).
The electrons carried by NADH are then used to generate ATP through oxidative phosphorylation, which is a process that takes place in the mitochondria. During oxidative phosphorylation, the electrons are transferred from NADH to oxygen through a series of electron carriers. As the electrons move through the electron carriers, they release energy that is used to pump hydrogen ions across the mitochondrial membrane. The hydrogen ions then flow back through the membrane through ATP synthase, an enzyme that converts ADP into ATP.
NADH is also involved in other cellular processes, such as DNA replication and repair, and the synthesis of lipids and steroids.