A generator is technology based on the scientific phenomenon that is today known as faraday's law.
If you have a loop of wire and you stick it into a magnetic field, well, then you'll have a loop in a magnetic field. No big deal. But if you then do something that changes the magnetic field somehow - either by changing the strength of the field, or its orientation relative to the loop - then if you are paying attention to such things you will notice that there is suddenly a current flowing in the wire. And when you stop moving the field around, the current stops flowing. Faraday's law is a mathematical statement of this observed natural phenomenon, which is called induction.
Anyway, a generator is a thing that uses induction to convert mechanical energy to electrical energy. It is basically what I just said - some big permanent magnets arranged such that there is a region of space with a strong magnetic field between them - and some big coil of wire in the middle.
This coil is attached to a rod which leads out of the device and to a handle, or gears, or engine or turbine, or basically some -thing- that makes it spin. The mechanical energy of the spinning is then converted into electrical energy, which drives the current in the loop, and powers whatever electrical device the two ends of the loop are attached to!
And, basically that's it. Because the coil goes around and around, the current flows back and forth in a sine-wave pattern, and that's why generators are used for making alternating current, which is what is in the power grid and the walls of your house.
Note that an electric motor is essentially a generator that operates in reverse - you connect some driving AC voltage to the coils, and the changing current causes a magnetic field to form which opposes that of the permanent magnets, so (as anyone who has ever played with magnets will tell you) there is a considerably strong force that pushes the coil away from the magnet. With proper design you can make it keep pushing itself all the way around a circle, and voila, you have a motor.