An electric generator works by turning mechanical energy into electrical energy. It's done by using the principle of electromagnetic induction- creating an electric current by moving a wire next to a magnet.