• Brainly User
This requires quantum mechanics which is not higher secondary portions but 
still u can assume that 

 **when a current or a group of electron move in circular path they produce changing electric fields which in turn produce magnetic fields (accordin to Maxwells laws )

** In magnets electrons rotate around the nucleus in some wat circular path this produce magnetic fields thus  a part of it acts as north and south pole 
depending on the direction of rotation clockwise anticlockwise 

** some iron pieces  have electrons in it , they get rotated in the direction opposite to the direction of rotation of electron in magnets and get attracted

**a north pole of magnet makes the iron pieces nearer end as south pole