5. In Figure 1, the square $ABCD$ is composed of six equilateral triangles. When it is folded along the dotted lines, it forms a hexahedron shaped like a zongzi (sticky rice dumpling) as shown in Figure 2. In this hexahedron, the cosine of the angle between $AB$ and $CD$ is $(\quad)$.
(A) 0
(B) 1
(C) $\frac{1}{2}$
(D) $\frac{5}{6}$
5. C.

Take the middle dashed line $E F$, dividing $\square A B C D$ into two parts, each consisting of three small equilateral triangles. The three small equilateral triangles on the left fold up (point $B$ coincides with point $F$) to form a bottomless regular triangular pyramid, with $A B$ and $E F$ as its two base edges.

Similarly, the three small equilateral triangles on the right fold up (point $D$ coincides with point $E$) to form the other half of the pyramid, with $C D$ and $E F$ also being edge lines. Therefore, after folding, $A B$ and $C D$ are two sides of an equilateral triangle, and the cosine of the angle between them is $\frac{1}{2}$.