6. Let $x$ and $y$ be integers, and satisfy
$$
x y + 2 = 2(x + y) \text{.}
$$

Then the maximum possible value of $x^2 + y^2$ is ( ).
(A) 32
(B) 25
(C) 18
(D) 16
6.B.

From the given, we have $(x-2) y=2 x-2$, which is $y=\frac{2 x-2}{x-2}=2+\frac{2}{x-2}(x \neq 2)$.
Since $x, y \in \mathbf{Z}$, it follows that $x-2= \pm 1, \pm 2$. Therefore, $(x, y)=(0,1),(1,0),(3,4),(4,3)$. Hence, the maximum possible value of $x^{2}+y^{2}$ is $3^{2}+4^{2}=25$.