5. As shown in the figure, square $A B C D$ and square $A E F G$, connect $B E$, $C F$, $D G$. Then $B E: C F: D G$ equals ( ).
(A) $1: 1: 1$
(B) $1: \sqrt{2}: 1$
(C) $1: \sqrt{3}: 1$
(D) $1: 2: 1$
5. (B).

As shown in the figure,
$\triangle A B E \cong \triangle A D G$.

Connect $A C$ and $A F$.
$$
\begin{array}{l} 
\because \angle C A F=45^{\circ}-\angle B A F \\
=\angle B A E, \\
\frac{A C}{A B}=\sqrt{2}, \frac{A F}{A E}=\sqrt{2}, \\
\therefore \frac{A C}{A B}=\frac{A F}{A E} .
\end{array}
$$

Therefore, $\triangle A C F \backsim \triangle A B E$.
Thus, $\frac{C F}{B E}=\frac{A C}{A B}=\sqrt{2}$.
$$
\therefore B E: C F: D G=1: \sqrt{2}: 1 \text {. }
$$