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