II. (20 points) As shown in Figure 3, in the right triangle $\triangle ABC$, $\angle C=90^{\circ}, BC = 2, AC = x$, point $F$ is on side $AB$, points $G$ and $H$ are on side $BC$, and quadrilateral $EFGH$ is a square with side length $y$, and $AE = AC$.
(1) Find the function expression of $y$ in terms of $x$.
(2) For what value of $x$ does $y$ reach its maximum value? And find the maximum value of $y$.
(1) As shown in Figure 5, extend $FE$ to intersect $AC$ at point $D$. Clearly, $DF \parallel BC$, then
$\mathrm{Rt} \triangle ADF \sim$
Rt $\triangle ACB$.
Noting that $AE = AC = x$, we have
$DE = \sqrt{x^2 - (x-y)^2} = \sqrt{2xy - y^2}$.
Thus, $\frac{x-y}{x} = \frac{\sqrt{2xy - y^2} + y}{2}$
$$
\Rightarrow 2x - 2y - xy = x \sqrt{2xy - y^2} \text{. }
$$

Squaring both sides and simplifying, we get
$$
\left(x^2 + 2x + 2\right) y^2 - \left(x^3 + 2x^2 + 4x\right) y + 2x^2 = 0 \text{. }
$$

Solving for $y$, we get $y = \frac{2x}{x^2 + 2x + 2}$ (the other solution $y = x$ is discarded).
(2) From (1), we have
$$
y = \frac{2}{x + \frac{2}{x} + 2} \leq \frac{2}{2\sqrt{2} + 2} = \sqrt{2} - 1 \text{. }
$$

Equality holds if and only if $x = \frac{2}{x}$, i.e., $x = \sqrt{2}$.
Therefore, when $x = \sqrt{2}$, $y$ attains its maximum value $\sqrt{2} - 1$.