Simplest way i can explain is the way magnets work on and electric current. If you bring a magnet near a wire with current flowing through it it will restrict or stop it. If you put the magnets in motion they can chase or push the electrons through the wire. An electric generator uses magnets to push electrons in the wires wrapping it to physically force them to form a current. This same principle works on the magnet as well, as the electrons will try to force its way past and move the magnet out of their way. Electricity works a lot like hydraulics, so if you imagine an old mill wheel with water flowing by its the same exact principle. The magnets would be the paddles in this example and the electric current would be the water. If you were to force the mill wheel to turn it would push the water(generator), the water can also turn the wheel though(motor). So basically in the simplest of terms a generator and a motor are the same, it has a working fluid and a paddle. It depends on which way you drive it to determine which.