Where is wrong with this fake proof that Gaussian integer is a field?

"Since $x^2+1$ is an irreducible element, the ideal $(x^2+1)$ is maximal"

Is this true in a generic integral domain? Consider the ring $Z[x,y].$ We have that $x$ is an irreducible element, but $(x)$ is not a maximal ideal, as it is contained in the ideal $(x,y)$ which is still not the entire ring.


$(x^2+1)$ is a prime ideal but not maximal.

it happens in a ring of Krull-dimension $\geq 2$. $\dim \mathbb{Z}[X] = 2$.


The statement that $(x^2+1)$ is maximal is false.

The maximal ideals of $\mathbb Z[x]$ are of the form $(p, x)$ where $p$ is a prime.