A magnetic field is created around a current-carrying conductor. This magnetic field exerts a force on the compass's needle force on the magnetic needle of a compass, and therefore the needle exhibits deflection.
The topic "Compass Needle Deflection" is available as part of this package. Subscribe this package to get access to this topic.