they have a negligible mass and they also have a negative charge so they have an association with the magnetic field. Do you remember polar? So electrons are negative and they attract the nucleus which is overall postivie (since protons are positive) so they act as magnetic since they both have an attraction