If $a+b\mathrm i$ is prime in $\mathbb Z[\mathrm i]$, then $a^2+b^2=(a+b\mathrm i)(a-b\mathrm i)$ has only two prime factors in $\mathbb Z[\mathrm i]$, and thus (by unique factorization in $\mathbb Z[\mathrm i]$) at most two prime factors in $\mathbb Z$. If it is prime in $\mathbb Z$, we are done. Otherwise (again by unique factorization in $\mathbb Z[\mathrm i]$) its two prime factors in $\mathbb Z$ must be associates of its two prime factors $a+b\mathrm i$ and $a-b\mathrm i$ in $\mathbb Z[i]$. Thus $a+b\mathrm i$ is an associate of an element of $\mathbb Z$, so $ab=0$.
Conversely, if $z$ is not prime in $\mathbb Z[\mathrm i]$, so that $z=rs$ with $r$ and $s$ not units, then $N(z)=N(r)N(s)$ (where $N(a+b\mathrm i)=a^2+b^2$ is the norm on $\mathbb Z[i]$), and $N(r)$ and $N(s)$ are not units, so $N(z)$ is not prime in $\mathbb Z$.