The monochromatic spectrum and the hue wheel are different 1D paths through 3D color space
Since human color vision involves three types of cone cells, all the colors a human can see can be represented as a region of 3D space.
The most straightforward of these spaces is LMS space (long, medium, and short wavelength), where the coordinates of a point in space represent the stimulation of each type of cone cell. LMS space can be transformed with a linear transformation to the more convenient XYZ space. The axes of XYZ space were chosen to have useful properties, but for our purposes, it just produces nicer looking plots. Note that not all points in LMS space or XYZ space represent colors humans can see; for instance, a cone can't be stimulated by a negative amount.
The below "chromaticity diagram" is a plot of a 2D slice of XYZ color space in the plane $X + Y + Z = 1$.
The colored region of the plot, label "visible region", contains points in the space representing colors humans can see, while the non-colored region contains points representing physically impossible cone stimulations. The top edge of the colored region corresponds to monochromatic colors. The circled vertices of the triangle labeled "sRGB region" represent the red, green, and blue primary colors used by an sRGB monitor, and the edges and interior of the triangle are linear combinations of the primaries. Note that only colors in the sRGB region can be reproduced by an sRGB monitor, so colors outside the region in the diagram are clamped to nearby sRGB colors.
Finally, the answer: the visible light spectrum is the non-closed path along the top edge of the colored region, and the hue wheel is some closed path through the colored region. The exact path of the hue wheel varies, but it is often chosen to be the perimeter of the triangle defined by the three sRGB primaries.
Notice that the bottom edge of this triangle approaches the bottom edge of the colored region, which does not represent monochromatic colors, but instead combinations of red and blue, giving magenta.