The diagram shows a coil wound around a soft iron bar XY. The polarity at the ends X and Y are
X- north pole, Y- south pole
According to clock rule, since the current at the end X is anti-clockwise so it becomes north pole and the current at end Y is clockwise so it becomes south pole.