A generator produces electrical energy by electromagnetic induction. Generators or dynamos of various sizes are used for different purposes.
The current produced from a small dynamo is used to light up a bicycle lamp. Huge generators are used in power plants to generate electricity for mass usage. In all cases the basic operating principle is the same i.e. the mechanical energy is used to move a conductor through a magnetic field to produce electrical energy.
A generator is basically the inverse of a motor. A generator consists of many coils of wire wound on an armature that can rotate in a magnetic field. The axle is turned by some mechanical means (e.g. falling water, steam,wind etc) so that the coil cuts the magnetic field lines as it rotates.