Let $\mathbb{N}$ be the set of positive integers. Prove that $f(x)=x$ is the only function from $\mathbb{N}\to\mathbb{N}$ for which $(x^2 + f(y)) | (f(x)^2 + y)$ for all $x,y \in \mathbb{N}.$
It's straightforward to show that $f(x)=x$ satisfies the required properties. Let $f$ be a function satisfying the problem conditions. Then $1+f(1) | (f(1)^2 + 1).$ Letting $a = f(1)$, we get a contradiction for $a > 1$ as $a^2 + 1\equiv 2\mod a+1\not\equiv 0\mod a+1$. Let $k\in\mathbb{N}.$ We know that $(1^2 + f(k)) | (f(1)^2 + k) = (k+1).$ So clearly $f(k) \leq k.$ $(k^2 + f(1)) | (f(k)^2 + 1).$ Thus if $f(k) < k,$ we get a contradiction. So $f(k) = k.$
Am I missing something above or is my proof correct?
Your approach looks fine. Just for fun, here is another way to prove things.
Since $f:\mathbb{N}\to\mathbb{N}$, $x+f(x)$ is positive for all $x\ge1$, so
$$(x^2+f(y))\mid(f(x)^2+y)\implies x^2+f(y)\le f(x)^2+y\implies f(y)-y\le(f(x)-x)(f(x)+x)$$
Setting $x=y$, we find that $f(y)-y\le(f(y)-y)(f(y)+y)$, which tells us $f(y)-y\ge0$ (since $f(y)+y\gt0$ for $y\ge1$). It thus suffices to show that $f(1)=1$, since that will give us $f(y)=y$ for all $y$ from $0\le f(y)-y\le(f(1)-1)(f(1)+1)=0$.
To show $f(1)=1$, note that $(1^2+f(1))\mid(f(1)^2+1$ implies $f(1)^2+1=k(1+f(1))$ for some positive integer $k$, from which the quadratic formula tells us
$$f(1)={-k\pm\sqrt{k^2-4(1-k)}\over2}$$
But for this to be an integer, we must have $k^2-4(1-k)=(k+2)^2-8=m^2$ for some integer $m$. And the only two squares that differ by $8$ are $9$ and $1$, which tells us $k=1$, and thus $f(1)^2+1=1+f(1)$, which simplifies first to $f(1)^2=f(1)$ and then to $f(1)=1$ (since $f(1)\ge1$).