$r = \sqrt{x^2+y^2}$

$\tan \theta = \dfrac{y}{x} = \dfrac{\text{opp}}{\text{adj}}$

So, $\cos \theta = \dfrac{\text{adj}}{\text{hyp}} = \dfrac{x}{\sqrt{x^2+y^2}}$

Or, you have $x = r\cos \theta$, so $\cos \theta = \dfrac{x}{r} = \dfrac{x}{\sqrt{x^2+y^2}}$ gives the same result.

Plugging in, you have:

$\sqrt{x^2+y^2} = 2-\dfrac{x}{\sqrt{x^2+y^2}}$

Multiply out by $\sqrt{x^2+y^2}$

$x^2+y^2 = 2\sqrt{x^2+y^2}-x$

$(x^2+y^2+x)^2 = 2^2(\sqrt{x^2+y^2})^2$

$x^4+y^4+x^2+2x^2y^2+2x^3+2xy^2=4x^2+4y^2$

$x^4+2x^3-3x^2+2x^2y^2+2xy^2-4y^2+y^4=0$

It appears your teacher made a mistake with the $xy^2$ term, writing $xy$ instead of $2xy^2$.