Electricity is mostly generated in places called power stations. Most power stations use heat to boil water into steam which turns a steam engine. The steam engines turbine turns a machine called a generator. Generators have wires inside which spin inside a magnetic field. Electromagnetic induction causes electricity to flow through the wires.
There are many sources of heat which can be used to generate electricity. Heat sources can be classified into two types renewable energy resources in which the supply of heat energy never runs out and non renewable energy resources in which the supply will be eventually used up.
Sometimes a natural flow, such as wind power or water power, can be used directly to turn a generator so no heat is needed.