Why do two parallel wires with currents in opposite directions repel?
Two parallel wires carrying electric currents in opposite directions repel each other due to the interaction between the magnetic field produced by one wire and the current flowing through the other.12
According to Ampère’s law, a current flowing through a wire generates a magnetic field that circles the wire. When two wires are placed near each other, each wire is effectively positioned within the magnetic field created by the other. The magnetic force exerted on a current-carrying wire in an external magnetic field is determined by the Lorentz force, which acts on the moving charges within the conductor.1234
When the currents flow in opposite directions, the right-hand rule dictates that the magnetic fields and the resulting forces interact in a way that pushes the wires apart. Conversely, if the currents were flowing in the same direction, the interaction would result in an attractive force.142