B is at (x,y) in Z=0 plane. So, B is perpendicular to OP.
From the figure,
→B=Bsinθ^i−Bcosθ^j
∵sinθ=yr,cosθ=xr&B=μ0I2πr
B=μ0I(y^i−x^j)2π(x2+y2)