Assuming this is supposed to be:
dx/dy+xcot(y)=2y+y²cot(y),
we can multiply through by sin(y):
sin(y)dx/dy+xcos(y)=2ysin(y)+y²cos(y).
That is:
d/dy(xsin(y))=d/dy(y²sin(y)).
Integrating both sides:
xsin(y)=y²sin(y)+C, where C is the constant of integration.
Therefore:
x=y²+Ccosec(y).
Plugging in x=0 and y=π/2:
0=π²/4+C, so C=-π²/4 and x=y²-¼π²cosec(y).
[The given equation dx/dy+cot(y)=2y+y²cot(y) would give us:
x=y²-ln|sin(y)|+∫y²cot(y)dy, which contains an indefinite integral that would be very difficult or impossible to calculate in general terms.]