When a current passes through a wire, it creates a magnetic field that obeys the right-hand grip rule and can be calculated using the equation B=2πaμoI.
The direction of this magnetic field, due to wire X in the region of wire Y, will be out of the screen, according to the right-hand grip rule, and the strength can be calculated using B=2πaμoIX.
A compass needle is used to determine the direction of the magnetic field at any point by placing it parallel to the wire and observing its orientation relative to the north-south axis.