Ah magnetic fields. They are very difficult things to explain.
Ok, let’s start with electrostatic force. So an electron is negatively charged, and a proton is positively charged. If I have an atom, and it has more protons than electrons, it’s positively charged and will attract negatively charged objects. If the atom has more electrons than protons, it’ll attract positively charged objects.
Now, if I gave you two football-sized objects, one positively charged and one negatively charged, and you held them in 2 separate hands, the objects would attract each other due to electrostatics right?
Now, get this. If you started running, you’d still be able to detect the field as an electrostatic field between the 2 balls. But if I was standing in the same room as you, watching you run, I wouldn’t detect an electric field – I’d detect a magnetic field!
Because all a magnetic field is is a moving electric field! There is some very complicated maths behind this How weird is that?
Here is an excellent video from Veritasium and Minute Physics about why this works: