How does the idea of magnetic fields arising from circulating currents relate to permanent magnets?

Electrons have an intrinsic angular momentum, which is called spin. It is as if a electron is a rotating ball of electric charge. The directon of the spin is what the rotation axis would be.

In a permanent magnet some fraction of the electron spins are alligned. This is like having a lot of circular currents that are all generating magnetic fields in the same direction.