A generator transforms power right into electrical power, while an electric motor does the other - it transforms electrical power right into power. Both tools function due to electromagnetic induction, which is when a voltage is generated by an altering electromagnetic field. I saw a relevant website "Generator Roundup". Where I got better info about generators.
Also check out CHP generators. For cogeneration, the engine or turbine uses combustible fuels to create mechanical movement. The electrical charges are then passed through an electric circuit to produce electricty.
This blog goes more in depth http://www.impcorporation.com/blog/what-is-cogeneration
what
In a generator running on fossil fuels, chemical energy is converted to heat energy through the combustion of fuel. The heat energy is then converted to kinetic energy in the prime mover. The kinetic energy is again converted to electrical energy through the principle of electromagnetic induction inside the alternator.