Magnets spin when electricity is passed through the coil of the electric motor. Whatever device used the motor, the spinning magnets and the axle provided power. If you spin the motor out, it becomes a generator.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.