Most students who have had some chemistry know about the principle of the Second Law of Thermodynamics with respect to increasing disorder of a system. Cells are very organized or ordered structures, leading some to mistakenly conclude that life somehow violates the second law. In fact, that notion is incorrect. The second law doesn’t say that entropy always increases, just that, left alone, it tends to do so, in an isolated system. Cells are not isolated systems, in that they obtain energy, either from the sun, if they are autotrophic, or food, if they are heterotrophic. To counter the universal tendency towards disorder on a local scale requires energy. As an example, take a fresh deck of cards which is neatly aligned with Ace-King-Queen . . . . 4,3,2 for each suit. Throw the deck into the air, letting the cards scatter. When you pick them up, they will be more disordered than when they started.
However, if you spend a few minutes (and expend a bit of energy), you can reorganize the same deck back to its previous, organized state. If entropy always increased everywhere, you could not do this. However, with the input of energy, you overcame the disorder. The cost of fighting disorder is energy.
There are, of course, other reasons that organisms need energy. Muscular contraction, synthesis of molecules, neurotransmission, signaling, thermoregulation, and subcellular movements are examples. Where does this energy come from? The currencies of energy are generally high-energy phosphate-containing molecules. ATP is the best known and most abundant, but GTP is also an important energy source (required for protein synthesis). CTP is involved in synthesis of glycerophospholipids and UTP is used for synthesis of glycogen. In each of these cases, the energy is in the form of potential chemical energy stored in the multi-phosphate bonds. Hydrolyzing those bonds releases the energy in them.
Of the triphosphates, ATP is the primary energy source, acting to facilitate the synthesis of the others by action of the enzyme NDPK. ATP is made by three distinct types of phosphorylation – oxidative phosphorylation (in mitochondria), photophosphorylation (in chloroplasts of plants), and substrate level phosphorylation (in enzymatically catalyzed reactions).