In the Haworth projection, why is the –CH2OH group pointing up?

The CH₂OH group is up because you have to rotate C-5 about the C4-C5 axis to form the ring.

Here are the two projections of D-glucose.

All the groups on the right-hand side of the Fischer projection are “down” in the Haworth formula, and the groups on the left-hand side are “up”.

It looks as if the -CH₂OH group should be “down”. Why is it up?

Let’s start with the Fischer projection. All the horizontal bonds are wedges.

It is easier to see the orientation of the vertical bonds if you turn the Fischer projection 90° and look at a side view of the structure. This gives us the curved backbone shown below.

To form the hemiacetal, the OH group on C-5 must be in the same plane as C-1. We must rotate C-5 120° about the C4-C5 bond.

This makes the bond to the -CH₂OH group a wedge and positions the C-5 OH group for attack on the carbonyl group at C-1.

To get the Haworth structure, we turn this projection onto its side.

The video below shows how to convert a Fischer projection of galactose to a Haworth projection.