The hydrogen-bond network of confined water is expected to deviate from that of the bulk liquid, yet probing these deviations remains a significant challenge. In this work, we combine large-scale molecular dynamics simulations with machine learning potential derived from firstprinciples calculations to examine the hydrogen bonding of water confined in carbon nanotubes (CNTs). We computed and compared the infrared spectrum (IR) of confined water to existing experiments to elucidate confinement effects. For CNTs with diameters >1.2 nm, we find that confinement imposes a monotonic effect on the hydrogen-bond network and on the IR spectrum of water. In contrast, confinement below 1.2 nm CNT diameter affects the water structure in a complex fashion, leading to a strong directional dependence of hydrogen bonding that varies nonlinearly with the CNT diameter. When integrated with existing IR measurements, our simulations provide a new interpretation for the IR spectrum of water confined in CNTs, pointing to previously unreported aspects of hydrogen bonding in this system. This work also offers a general platform for simulating water in CNTs with quantum accuracy on time and length scales beyond the reach of conventional first-principles approaches.