ATP is produced during

cellular/tissue respiration. Tissue respiration occur in two stages; the first stage (glycolisis), occur in both aerobic an anaerobic respiration. Glycolysis is the step wise breakdown of glucose to pyrulvic acid.
Six carbon glucose  phosphorylated into 6-carbon sugar. 2 molecules of ATP is used up in the process
Phosphorylated 6 carbon sugar broken down into two molecules carbon sugar each molecule of 3 carbon sugar is converted to pyrulvic acid
*2 molecules of ATP are produced per molecule of 3 carbon sugar
*each molecule of pyrulvic acid converted to 2 carbon acetyl-CoA
*this conversion requires oxygen
*3 molecules of ATP are produced per molecules of 3 carbon acetyl-coA
*acetyl-coA is fed into krebs cycle
*oxaloacetic acid, a 4 carbon compound accept 2 carbon acetyl-coA and form 6 carbon citric acid
*Series of step-wise enzyme controlled reaction occur.
*citric acid is gradually converted back to oxaloacetic acid
*this reaction involve decarboxylation and oxidation and it’s made possible by a series of carrier systems
*a total of 12 ATP molecules are produced for each molecule of acetic-coA going through the cycle.
ATP balance: phosphorylation of a 6 carbon sugar=2ATPs
Conversion of 3 carbon sugar to pyrulvic acid= +4ATPs
Conversion of pyrulvic acid to acetyl-coA= +6ATPs krebs cycle reactions= +26ATPs balance= +38ATPs
*Total of 38 ATP molecules produced per molecule of 6-carbon glucose oxidized.