Energy cannot be created. An electrical generator is simply a means of converting mechanical energy into electrical energy. In its simplest form, a generator spins coils of wire in a magnetic field, causing the flow of electrical current in the conducting wire. The power to spin the generator comes from other forms of energy. This energy might be stored energy in fossil fuels such as coal or oil, hydroelectric power from dams, wind power from turning huge windmills, or nuclear power produced by the radioactive decay of elements. In all these cases, one form of energy is simply converted into electrical energy.

Picture credit: google