Magnets can produce electricity.
Moving a magnet around a coil of wire, or moving a coil of wire around a magnet, pushes the electrons in the wire and creates an electrical current.
Electrical generators work through magnetism to create electricity.
Although the rotor and stator that has copper wire on it to create magnetism need a source of energy such as steam, gas engine etc to turn the rotor to make the electricity.
Whenever you bring coils and magnets together (in the proper orientation and moving with respect to each other), magic happens.
In this case, it is the Edisonian magic of lighting a light bulb.
Turning the crank rotates a coil inside of the large U-shaped magnets.
Electric generators work on the principle of electromagnetic induction.
A conductor coil (a copper coil tightly wound onto a metal core) is rotated rapidly between the poles of a horseshoe type magnet.
The magnetic field will interfere with the electrons in the conductor to induce a flow of electric current inside it.
Electromagnetic or magnetic induction is the production of an electromotive force across an electrical conductor in a changing magnetic field.
Michael Faraday is generally credited with the discovery of induction in 1831, and James Clerk Maxwell mathematically described it as Faraday's law of induction.
Today, electromagnetic induction is used to power many electrical devices.
One of the most widely known uses is in electrical generators (such as hydroelectric dams) where mechanical power is used to move a magnetic field past coils of wire to generate voltage.