The idea
An electric current produces a magnetic field. Reversing the current reverses the direction of the field around the wire.
Why might a compass near a current-carrying wire point differently when the current is reversed?
The wire's magnetic field changes direction. The compass aligns with the resulting field from the wire and Earth's field together.