It's main function is to produce ATP, the energy currency of the cell.
The mitochondria take fuel (glucose) and essentially burns it. The energy given off by oxidizing the fuel is harnessed by causing ions to move across a membrane, kind of like pumping water. The ions then flow down through a protein which synthesizes ATP much like the water then flows down through a dam to generate electricity.
The mitochodrian.