We have a natural norm $N$ on $\mathbb{Z}[i]$ given by $N(a+bi) = a^2 + b^2$, for all $a+bi \in \mathbb{Z}[x]$. One can show that w.r.t. this norm, $\mathbb{Z}[i]$ is a Euclidean domain, hence a PID, hence a UFD.
Let $p \in \mathbb{N}$ be a prime such that $p = a^2 + b^2$ for some $a,b \in \mathbb{Z}$. Now suppose $\exists c,d \in \mathbb{Z}$ such that $p = c^2 + d^2$. Then in $\mathbb{Z}[i]$ we have $N(a+bi) = p = N(c+di)$.
Suppose a+bi = (e+fi)(e' +f'i) in $\mathbb{Z}[i]$. Then taking norms (our norm $N$ is multiplicative) we have a^2+b^2 = p = (e^2+f^2)(e'^2 + f'^2), and so without loss of generality one can say that $e^2 + f^2 = p$. Then e'^2 + f'^2 = 1, and the only elements with norm 1 in $\mathbb{Z}[i]$ are $\{1,-1,i,-i\}$, which are also units. Thus, e'+f'i is a unit in $\mathbb{Z}[i]$, which shows that $a+bi$ is irreducible (actually one needs to use the fact that every unit of $\mathbb{Z}[i]$ has norm 1 to conclude that $a+bi$ is not a unit in the first place, but this is easy). Since, $N(c+bi)=p$, by a similar argument $c+di$ is irreducible in $\mathbb{Z}[i]$.
Then in $Z[i]$ we have $(a+bi)(a-bi) = p = (c+di)(c-di)$ is a factorization of $p$ into irreducibles. By unique factorization, say without loss of generality that $c+di = unit \times a+bi$ (here the unit is a unit of $\mathbb{Z}[i]$). Then you are basically done (why?).