In terms of energy transfer
- Electric motor: Electrical → Mechanical
- Electric Generator: Mechanical → Electrical
A motor and generator perform opposite functions, but their fundamental structure is the same. Their structure is a coil mounted on an axel within a magnetic field.
An electric motor is used to produce rotational motion from an electrical supply. In a motor an electric current is passed through the coil. The coil then creates a magnetic field that interacts with the already existing magnetic field. This interaction forces the coil to rotate. (If you want to know more about magnetic forces on current carrying conductors there is a lesson here.)
⇒ For a motor the input energy is electrical energy and the useful output energy is mechanical energy.
The generator is used to produce an electric current from rotational motion (on large scale power stations a turbine is used to provide this rotation). In a generator the rotation causes the coil to rotate inside the magnetic field.* This induces an alternating current in the coil.
⇒ For a generator the input energy is mechanical energy and the useful output energy is electrical energy.
*In power stations it is usually the magnet which is attached to the axel and rotated, with the coils surrounding the magnet. However the end result is the same.