Generator Principle

It is best if you read the page on the Magnetism first.
When a piece of wire is moved through a magnetic field, a voltage and current is induced in the wire.
The same effect is obtained if the wire is stationary and the field is moved.
The direction of current flow is determined by the direction of the field, and the direction of the movement.
The amplitude of the voltage is determined by the rate at which the wire cuts the lines of force. Increasing the density of the field or increasing the speed of the wire therefore increases the voltage.
Generator Principle Diagram
This principle is used in the electric generator, where a coil is rotated in a magnetic field to generate electricity.
It is also used in the moving coil microphone, where sound causes a coil to vibrate in a magnetic field, generating voltages which represent the sound waves.
The Electric Motor Principle is related. It relies on passing a current through a wire in a magnetic field to provide movement.