Solution 1:

Let $p\equiv3\pmod 4$ a prime, and suppose that $p=mn$, where $m,n\in\mathbb{Z}[i]$. Then of course $|p|=|m|\cdot|n|$, in other words $$p^2=|m|^2\cdot|n|^2.$$ Assuming the decomposition is not trivial, one concludes $$|m|=|n|=p,$$ and that makes $p$ the sum of two squares, which is impossible by assumption on $p$ (see explanation below).

Thus $p$ is irreducible in $\mathbb{Z}[i]$, and since it is a unique factorization domain, $p$ is prime.

Explanation: As one can verify immediately, for every integer $n$ one of the following holds: $n^2\equiv0\pmod 4,$ or $n^2\equiv1\pmod 4$. It follows that the sum of two squares can't be $\equiv3\pmod 4$.

Solution 2:

Disclaimer: there are other proofs of this, among which one can find a proof with quadratic forms, infinite descent and etc. The following is easier for me.

You must prove that a prime $\;p\;$ is the sum of two squares iff $\;p=1\pmod 4\;$. For this, we first show that $\;-1\;$ is a square $\;\pmod p\iff p=1\pmod 4\;$ :

Let us look at the (cyclic) multiplicative group of the integers modulo $\;p\;$ , i.e. $\;\Bbb F_p^*:=\Bbb F\setminus\{0\}\;$ .

== If $\;x^2=-1\pmod p\;$ has a solution then $\;x^4=1\pmod p\;$ . But we also know (Fermat's Little Theorem) that $\;x^{p-1}=1\pmod p\;$ (since clearly $\;x\neq 0\pmod p\;$ , and from Lagrange's Theorem we get that

$$\;4\mid (p-1)\iff p=1\pmod 4\;$$

The other direction I leave to you (use that a cyclic finite group has one unique subgroup of any order dividing the group's order).

From the above if follows that if $\;p=1\pmod 4\;$ then $\;p\mid m^2+1\;$ for some integer $\;m\;$ (which can also be considered as an element in $\;\Bbb F_p^*\;$ is wanted).

But $\;\;m^2+1=(m-i)(m+i)\;,\;\;i=\sqrt{-1}=\;$ the square root of $\;-1\;$ we proved above to exist. But $\;p\;$ doesn't divide either of $\;m-i\,,\,\,m+i\;$ (why? Look at the imaginary parts and, of course, the fact that the gaussian integers are a Unique Factorization Domain (why?)), so $\;p\;$ cannot be prime in $\;\Bbb Z[i]\;$ , and since the norm on this ring is multiplicative and $\;\mathcal N(p)=p^2\;$ , we must have a factorization in two elements with the same norm:

$$p=(x+iy)(x-iy)=x^2+y^2\;,\;\;\text{and we're done}$$

Now, what the above has to do with your question?? Well, if $\;p\;$ is not a prime $\;=1\pmod 4\;$ then it is not a sum of squares and thus, from the last part of the proof above, it must be prime in $\;Z[i]\;$ as its norm still is the square of a prime in $\;\Bbb Z\;$ !