That's an excellent question, Joza, and it's actually what motivated me to stick with my Physics education all the way through grad school. I always kept a magnet on my desk so that whenever I became discouraged and wondered why I was doing what I was doing, I would pick up the magnet and just remind myself that I simply wanted to understand as well as I could what was going on.
That said, CraigD is right - it's one of the "fundamental" forces, so in some sense it doesn't "come from" anything else more fundamental. On the other hand, the more precise statement is that it's the electromagnetic force that is fundamental -- so-called because electricity and magnetism were found to be different aspects of the same thing back in the 1800s. To understand magnetism, you must understand electricity, and vice versa.
In practical terms, however, you can explain how a given magnetic field comes about. One way that would be theoretically possible (according to Classical Physics), would be from a "magnetic monopole", which is a particle carrying a fundamental unit of magnetic charge, like a single North pole or a single South pole. As it happens, these have never been seen in nature. Instead we have particles that carry fundamental units of electrical charge, such as the electron.
You probably know that you can create a magnetic field by passing an electric current through a wire (i.e. an electromagnet). Well, even permanent magnets get their fields from the same source, namely the tiny electrical currents carried by the electrons in the substance. Some materials just happen to be such that the orientations of all the tiny fields generated this way all line up together, and you get a total field that you can detect.
I hope this was interesting to you.
-Bruce