we all know that iron is magnetic as it gets attracted by magnet but copper is not. but when current is passed through copper or any other metal it behaves like an electromagnet. how does this work? why metals behaves like a magnet when current is passed through them?
actually its the consequence of special theory of relativity given by einstein. absolute relativity says that time and length are absolute. time for a moving object moves slower than the time moving for an object in respect to the observer. faster anything goes shorter it gets. length gets contracted when it moves close to the speed of light.
length contraction is responsible for electromagnetism.

imagine two copper wire having positive metal ions swimming in free negative electrons. number of electrons is equal to the number of positive ions therefore it is neutral and hence if there was a positive charge nearby it will not feel any force. if there is a current flowing through the first conductor electrons start moving. now in wire electrons are moving, whereas, in other wire both positive and negative charges are at rest. let us take velocity of electrons as ‘v’. now moving electrons in first wire have the velocity of ‘2v’. using relativity, electrons in the first wire gets contracted and became more dense. now first wire has more electrons than the second wire in frame of reference of the observer. in the second wire positive charges are tends to move thus contracting and getting dense in first wire’s frame of reference. and due to this both gets attracted which we say that first wire gets magnetized.

if you have any queries or need some more information about the topic let me know through the comments or you can contact me through Gmail.