Electrons spinning around an atom's center (the nucleus) create a tiny magnetic field. In most objects, the electrons spin in random directions, and their magnetic forces cancel each other out, which is why most things aren’t magnetic.
Magnet structure
Magnets are different because their electrons all spin in the same direction. This organized movement creates a larger magnetic force that flows out from one end, the north-seeking pole, and returns through the other end, the south-seeking pole. This force creates a magnetic field around the magnet.
Magnetic fields
Have you ever played with two magnets? They don't act like most objects. If you push two north poles or two south poles together, they push each other away (repel). But, if you put a north pole and a south pole together, they will snap together (attract). Just like protons and electrons—opposites attract in magnets.
Magnets and electricity
The special properties of magnets are the key to making electricity. Magnetic fields pull and push electrons. Metals such as copper and aluminum have electrons that are loosely held. Moving a magnet around a coil of wire, or moving a coil of wire around a magnet, pushes out the electrons in the wire and creates an electrical current. Electricity generators essentially convert kinetic energy (the energy of motion) into electrical energy.