"The magnetic fields that are responsible for the interesting behaviors of magnets can be created either by (1) moving electric charge or (2) changing electric fields. We can ignore the second process because it has very little to do with permanent magnets. Instead, let's focus our attention on the first process: moving electric charge producing magnetic fields. Whenever electric charges flow through a wire, a phenomenon that we call an electric current, they create magnetism. Many appliances use electricity and electric currents to create magnetism, notably televisions, motors, and audio speakers. But a permanent magnet doesn't use an obvious electric current to create its magnetic field. Instead, it uses the spinning character of the electrons inside the material from which that magnet is made. Electrons are electrically charged and they have an intrinsic spinning character. A simplistic view of an electron is as a spinning, electrically charged ball. Since its charge is in motion, an electron acts as a magnet and has both a north pole and a south pole. In most materials, the magnetic electrons are turned in opposite directions, canceling out one another's magnetism so that the overall material is non-magnetic. But in a few special materials, including most steels, the cancellation is imperfect and some magnetism remains. In a permanent magnet, this remaining magnetism is particularly apparent. The material is, in effect, a big collection of magnetic electrons that all work together to create a large magnet."
The answer is in the above text. You know about electrons and their charge right? and how they move around?