Energy isn't created and magnets don't attract the magnetic field.
Exactly. Any generator uses external energy, typically in the form of mechanical energy, that is input into it to generate the electrical energy. You expend energy to rotate the shaft, which generates electrical current in the circuit. So this is merely energy transfer. Due to inefficiencies you cannot transfer your mechanical energy into electrical energy with 100% efficiency. Some will always be lost in the form of heat and friction.