An electric current flowing through a metallic conductor produces a magnetic field around it. This magnetic field can be detected by using a magnetic compass.
When a magnetic compass is placed near a current-carrying wire, the needle will deflect and align itself in the direction of the magnetic field at that point.