Why do magnets attract each other?
Countless tiny atomic magnets line up the same way, and aligned fields pull opposite poles together.
Every electron is a tiny magnet
Magnetism starts absurdly small. Each electron carries a property called spin, and a moving or spinning charge behaves like a microscopic loop of current, which produces a minute magnetic field of its own.
In most materials these tiny fields point in random directions and cancel. Iron, nickel, and cobalt are special: their atoms naturally nudge neighbors into pointing the same way.
Domains: neighborhoods that agree
Inside a chunk of iron, atoms cluster into regions called domains, where billions of atomic magnets all point one direction. In unmagnetized iron the domains themselves point randomly, so the bulk effect is roughly zero.
Expose that iron to a strong field and the domains swing into line and largely stay there. Now the tiny fields reinforce instead of cancel, and you are holding a permanent magnet.
Why two magnets pull together
Flip one magnet so like poles face, and the loops would have to collide head-on. That arrangement stores more energy, so the magnets shove apart instead. Attraction and repulsion are the same rule read in two directions.
Where the field actually lives
The pull you feel between two magnets is the bottom layer (electron spin) amplified billions of times over by alignment. Nothing reaches across the gap to grab; the field itself is the medium, and the force is the field seeking its calmest shape.