For a complex function to be analytic, it must satisfy the Cauchy-Riemann equations, which are:
\[
\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y} \quad \text{and} \quad \frac{\partial u}{\partial y} = -\frac{\partial v}{\partial x}
\]
where \( u \) and \( v \) are the real and imaginary parts of the complex function \( f(z) = u(x, y) + iv(x, y) \), respectively.
Step 1: Analyze \( f(z) \).
For \( f(z) = (x^2 - y^2) + i 2xy \), the real part \( u = x^2 - y^2 \) and the imaginary part \( v = 2xy \). The Cauchy-Riemann equations are:
\[
\frac{\partial u}{\partial x} = 2x, \quad \frac{\partial v}{\partial y} = 2x
\]
\[
\frac{\partial u}{\partial y} = -2y, \quad \frac{\partial v}{\partial x} = 2y
\]
Since \( \frac{\partial u}{\partial y} = -2y \neq -2y = -\frac{\partial v}{\partial x} \), \( f(z) \) does not satisfy the Cauchy-Riemann equations, so \( f(z) \) is not analytic.
Step 2: Analyze \( g(z) \).
For \( g(z) = 2xy + i(x^2 - y^2) \), the real part \( u = 2xy \) and the imaginary part \( v = x^2 - y^2 \). The Cauchy-Riemann equations are:
\[
\frac{\partial u}{\partial x} = 2y, \quad \frac{\partial v}{\partial y} = -2y
\]
\[
\frac{\partial u}{\partial y} = 2x, \quad \frac{\partial v}{\partial x} = 2x
\]
Since \( \frac{\partial u}{\partial y} = 2x = \frac{\partial v}{\partial x} \) and \( \frac{\partial u}{\partial x} = 2y = \frac{\partial v}{\partial y} \), \( g(z) \) satisfies the Cauchy-Riemann equations, so \( g(z) \) is analytic.
Step 3: Conclusion.
Therefore, \( f(z) \) is not analytic, and \( g(z) \) is analytic, making the correct answer (D).