A scientific theory is an explanation of an aspect of the natural world and universe that can be repeatedly tested and corroborated in accordance with the scientific method, using accepted protocols of observation, measurement, and evaluation of results. Established scientific theories have withstood rigorous scrutiny and embody scientific knowledge.
A scientific theory differs from a scientific fact or scientific law in that a theory seeks to explain "why" or "how", whereas a fact is a simple, basic observation and a law is an empirical description of a relationship between facts and/or other laws.
The mechanics of how magnetism works is a theory, in the same sense as gravity. The reality of magnetism (things stick/repel) is an observable fact, in the same way that the results of gravity (things fall down) are very real and factual.
In other words, magnets are real but magnetism is a scientific theory.