Electric generator
A generator is a motor run backwards: instead of feeding in electricity to get motion, you feed in motion to get electricity. The physics is Faraday's law — move a coil through a magnetic field (or spin a magnet past a coil) and a voltage appears across the coil. Spin it faster or with a stronger field and the voltage grows. A bicycle dynamo, a wind turbine, and the alternator under your car's bonnet are all the same idea at different scales.
In a power station, a turbine driven by steam, water, or wind spins a generator's magnetic rotor, and the resulting voltage is sent down the grid. Crucially, a generator and motor are the very same machine — the difference is only which way energy flows. This is why a hybrid or electric car can 'regenerate': when you brake, the wheels drive the motor as a generator, turning the car's motion back into charge for the battery instead of wasting it as heat in the brakes.
The same machine acting as a motor when you press the accelerator and as a generator when you brake is the heart of regenerative braking, which can recover 10–30% of an EV's energy in city driving.