I am a high school student and am not able to understand the reason behind the direction of deflection of the needle of a compass due to electric current.
When the compass is placed over the current-carrying wire which is going from south to north, the magnetic field lines because of the wire would be from west to east(According to the right hand thumb rule). So the north pole would be towards the west and south pole would be towards the east. A compass always points towards the geographic north pole i.e the magnetic south pole. So, the compass should point towards the south pole of this magnetic field i.e east. But according to the "Ampere's swimming rule/SNOW rule" the magnetic needle should point towards the west.
Can someone explain the reason behind this? Or in general, the reason behind the deflection of a compass?