Cells require an energy source to perform work including transport, mechanical work and chemical reactions necessary for life to continue. Sugars like glucose can be used by cells during respiration as a fuel which can provide energy for cellular processes. Glucose contains potential energy stored in its chemical bonds. Once respiration occurs, the energy in glucose becomes available to perform cellular work and the waste products carbon dioxide and water are formed.
Respiration is a catabolic pathway because the more complex molecule glucose is broken down to simpler compounds. Catabolic pathways release energy.
The Principle of Conservation of Energy explains that energy can be transferred and transformed from one form to another but cannot be created or destroyed. The chemical energy in glucose originated as light energy that was captured by the chlorophyll of green plants in order to produce the glucose (chemical energy). Some heat was also released. As the glucose is consumed and cellular respiration takes place, ATP is formed.
ATP contains the sugar ribose, the base adenine and three phosphate groups. ATP is an immediate source of energy for cellular work. It has a high amount of energy which is stored in the phosphate tail. Once the last phosphate group is removed from the ATP molecule by hydrolysis, it will form ADP plus inorganic phosphate. ADP is a lower energy molecule. The release of energy during hydrolysis of ATP can be harnessed by the cell to do work.
Living things continuously use ATP but it is renewable and can be recycled. As other catabolic reactions occur in a living cell, the release of energy can be used to regenerate more ATP from ADP and inorganic phosphate.
To summarize, the energy in the ATP molecule comes from energy that is released by catabolic reactions like cellular respiration which occurs in the mitochondria. The energy was originally in the glucose molecule. This energy can be used to join ADP plus inorganic phosphate to form the high energy ATP molecule.