Final answer:
When a wire carrying an electric current is brought near a compass, the interaction between the magnetic field induced by the current and the magnetic field of the compass needle causes the needle to deflect.
Step-by-step explanation:
The deflection of a compass needle when brought near a wire carrying an electric current can be explained by the interaction between the magnetic field induced by the current and the magnetic field of the compass needle. When a current passes through a wire, it produces a magnetic field around the wire.
The magnetic field from the wire interacts with the magnetic field of the compass needle. According to Maxwell's equations, the interaction between moving charges and magnetic fields causes a force on the compass needle, resulting in its deflection.