The earth acts like a huge magnet. Thus in the absence of electric current a compass needle always comes to rest in Earths North-south direction. However, when current passes through the circuit the needle comes to rests in the direction opposite to the magnetic field of Earth i.e. South-North direction.