The chain or network of hydroxyl groups (OH − ) is crucial in determining the structure and function of materials, especially in hydroxyapatite (HAP), a mineral essential for human bones. HAP exhibits a linear arrangement of OH − along the c-axis, which determines its phase transition, dielectric, and piezoelectric properties. However, the mechanism underlying OH − reorientation with temperature remains elusive using traditional experimental and theoretical methods. To address this, we developed a machine learning atomistic potential for HAP using an active learning algorithm, which achieved density functional theory-level accuracy in describing OH − of HAP. The machine learning molecular dynamics simulations revealed that the reorientation of OH − in HAP with temperature occurs through ″flip-flop″ motion, rather than proton transfer. This process starts at about 473 K and accelerates with increasing temperature, consistent with the experimentally observed transformation from the monoclinic to hexagonal phase. At 973 K and above, the rapid "flip-flop" reorientation process leads to an undetermined orientation of OH − along the c-axis. These findings highlight the potential of machine learning-accelerated molecular dynamics simulations in unraveling the microscopic mechanisms underlying the hydrogen bond network in complex multicomponent materials at the atomic level.