Divide both sides by [tex]x^2[/tex] - note that this means we can't have [tex]x=0[/tex]:
[tex]x\dfrac{\mathrm dy}{\mathrm dx}-y=x^2\sin x[/tex]
[tex]\dfrac1x\dfrac{\mathrm dy}{\mathrm dx}-\dfrac1{x^2}y=\sin x[/tex]
Then the left side reduces to the derivative of a product,
[tex]\dfrac{\mathrm d}{\mathrm dx}\left[\dfrac1xy\right]=\sin x[/tex]
[tex]\dfrac1xy=\displaystyle\sin x\,\mathrm dx=\cos x+C[/tex]
[tex]y=x\cos x+Cx[/tex]
This solution is continuous everywhere, but accounting for the singular point [tex]x=0[/tex], the largest interval over which it is defined would be [tex](0,\infty)[/tex] or [tex](-\infty,0)[/tex].