High pressure is an effective method to induce structural and electronic changes, creating novel high-pressure structures with excellent physical and chemical properties. Herein, we investigate the structural phase transition of hafnium dihydrogen (HfH2) in a pressure range of 0 GPa–500 GPa through the first-principles calculations and the crystal structure analysis by particle swarm optimization (CALYPSO) code. The high-pressure phase transition sequence of HfH2 is I4/mmm → Cmma → P-3m1 and the two phase transition pressure points are 220.21 GPa and 359.18 GPa, respectively. A newly trigonal P-3m1 structure with 10-fold coordination first appears as an energy superior structure under high pressure. These three structures are all metallic with the internal ionic bonding of Hf and H atoms. Moreover, the superconducting transition temperature (T c) values of Cmma at 300 GPa and P-3m1 at 500 GPa are 3.439 K and 19.737 K, respectively. Interestingly, the superconducting transition temperature of the P-3m1 structure presents an upward trend with the pressure rising, which can be attributed to the increase of electron–phonon coupling caused by the enhanced Hf-d electronic density of states at Fermi level under high pressure.