Water is produced by our bodies as a byproduct of the metabolism during a process called cellular respiration, in which glucose and oxygen are used to produce energy for cells. This process is somewhat complicated and involves a number of steps, but water is formed in the final step. This is the same process that produces the carbon dioxide that we exhale. It is also called aerobic respiration because it uses oxygen to produce energy.
During cellular respiration, first glucose (sugar) from the food that we eat is broken down to create the molecules Pyruvate and adenosine triphosphate (ATP). ATP is the main source of energy for cells and is a powerful energy storage molcule.
Glycolysis utilizes the compounds NAD+ and NADH, two enzymes, to produce some ATP. However, most of the ATP that cells use is made later in cellular respiration. The Pyruvate produced during glycolysis is converted into Acetyl COA. Acetyl COA then enters the mitochondria of the cell to produce further energy in the presence of oxygen. This is when water is produced by the metabolism. In the mitochondria, electrons from the molecules NADH and FADH2 are used for energy to power a set of reactions that will ultimate produce ATP, the powerhouse for the cell.
Toward the end of cellular respiration in the mitochondria, hydrogen and oxygen (`O_2`) react together, producing water in the process. The other oxygen atom from this process is used as the final electron acceptor in the electron chain. This is how water is produced in the body; essentially, hydrogen from various coenzymes in the cell combine with oxygen from the lungs and create water as a byproduct.