moving charges induce a magnet field. for example, currrent moving through a wire creates a magnetic field. Its almost imperceptible in most electronics because the current is very low. Our planet has a magnetic field because of charged particles in the mantle/core, and the rotation of the earth.