It depends on what organism you are talking about. Some organisms use photosynthesis (using the energy of the sun), while others use cellular respiration (release of energy in the presence of oxygen in the mitochondria). Still others use fermentation (release of energy in the absence of oxygen in the mitochondria).
I hope this helps.......