5. As shown in Figure 2, the side length of square $A B C D$ is 2. Equilateral triangles $\triangle A B E$, $\triangle B C F$, $\triangle C D G$, and $\triangle D A H$ are constructed outward from each side. Then the perimeter of quadrilateral $A F G D$ is ( ).
(A) $4+2 \sqrt{6}+2 \sqrt{2}$
(B) $2+2 \sqrt{6}+2 \sqrt{2}$
(C) $4+2 \sqrt{3}+4 \sqrt{2}$
(D) $2+2 \sqrt{3}+4 \sqrt{2}$
5. A.

As shown in Figure 7, connect $A F$, $A G$, and $G F$.
In the isosceles $\triangle A B F$, the vertex angle is $90^{\circ}+60^{\circ}=150^{\circ}$. In the isosceles $\triangle F C G$, the vertex angle is $360^{\circ}-90^{\circ}-2 \times 60^{\circ}=150^{\circ}$.
Since $A B=B C=F C$, we have $\triangle A B F \cong \triangle S C G$.
Therefore, $A F=F G$.
Similarly, $A F=A G$.
Let $K$ be the midpoint of $A B$, and connect $G K$. It is easy to see that $\triangle A K G$ is a right triangle, with $A K=1$ and $K G=2+\sqrt{3}$.
By the Pythagorean theorem, we have
$$
\begin{array}{l}
A G=\sqrt{1^{2}+(2+\sqrt{3})^{2}}=\sqrt{8+4 \sqrt{3}} \\
=\sqrt{(\sqrt{6}+\sqrt{2})^{2}}=\sqrt{6}+\sqrt{2} .
\end{array}
$$

Thus, the perimeter of quadrilateral $A F G D$ is
$$
\begin{array}{l}
A F+F G+G D+D A=2(\sqrt{6}+\sqrt{2})+2 \times 2 \\
=4+2 \sqrt{6}+2 \sqrt{2} .
\end{array}
$$