Find all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ such that $f(m^2 + f(n))=(f(m))^2 + n, \forall m,n \in \mathbb{Z} \tag 1$
If $m=0$ then $f(f(n))=f^2(0) + n \tag 2, \forall n$ From (2) $f \circ f$ is injective, therefore $f$ is injective.
Replacing $n=0, m:=-m$ in (1) we get $f(m^2 + f(0))=f^2(-m)$ therefore $f^2(m)=f^2(-m), \forall m \tag3$ From (3), using $f$ injectivity we get $f(-m)=-f(m), \forall m \ne 0 \tag 4$
Replacing $n:=-n$ in (2) we get $f(f(-n))=(f(0))^2 - n \tag 5$ and, from (4) and (5) $-f(f(n))=f^2(0) - n \tag 6$ Now, from (2) and (6) we get $f(0)=0$ therefore: $f(f(n))=n, \forall n \tag 7$ The last one proves $f$ is also surjective, therefore bijective.
It's also easy to prove $f(1)=1$. I have strong feelings that $f(n)=n, \forall n$ is the only solution, but I cannot prove it.
Any help is appreciated.
We prove by induction that $f(n)=n$ for all $n \in \mathbb N_0$:
The cases $n=0$ and $n=1$ are clear.
Now suppose $f(n)=n$ for some $n$. Then, use $f(m^2 + f(n))=(f(m))^2 + n$ with $m=1$,
$f(n+1)=f(f(n)+1^2)=f(1)^2+n=n+1$.
From $(4)$ you get
$f(m)=m$ for all $m \in \mathbb Z$.