Lenz's law in electromagnetism that an induced electric current flows in a direction such as the current combats the adjustment that induced it. Forcing a pole of a permanent bar magnet through a loop of wire induces an electric current in the coil, the current sets up a magnetic field around the coil, making it a magnet.
Lenz's law details the direction of the induced current because the magnetic poles of the same charge repel each other. Lenz's law says that when the north pole of the bar magnet is flowing towards the coil, the induced current flows in such a way as to make the side of the loop, closest to the pole of the bar magnet itself a north pole to oppose the coming towards the bar magnet.
Upon drawing the bar magnet from the coil, the induced current reverses, and the close side of the coil turns into a south pole to making an attracting force on the receding bar magnet.