With the development of GaN-based electronics towards higher frequency, higher power and smaller size, the heat dissipation problem is becoming a key bottleneck restricting its performance improvement. The lattice mismatch and high interfacial thermal resistance (ITR) between GaN and substrate materials such as Silicon Carbide (SiC) limit the heat conduction, and the ITR can be effectively reduced by introducing AlN as a transition layer or substitute substrate. Precise control of the AlN layer thickness is essential to reduce GaN/AlN ITR, dislocations, electron mobility, and crystal quality. In this study, the ITR of GaN/AlN at AlN layer thickness (from 1.3 nm at 2 layers to 5.8 nm at 11 layers) was calculated through molecular dynamics simulations (MD). Our findings reveal that an increase in the number of AlN layers leads to a substantial reduction in the ITR of the GaN/AlN. When the AlN layer increases from 2 to 8 layers, the ITR of GaN/AlN decreases by 52.36 %. When the number of AlN layers exceeds 8, the ITR of GaN/AlN tends to be stable with the increase in AlN layers. This indicates an optimal number of AlN layers, beyond which the effect of reducing the ITR will no longer be significant. The analysis shows that increasing the number of AlN layers causes the peak value of phonon modes at the GaN interface to widen in the frequency range of 20-25 THz, and the phonon vibration modes tend to diversify. This change enhances the coupling of phonon modes at the interface between GaN and AlN and plays an active role in reducing the ITR. In addition, the variation trend of the Phonon Density of States (PDOS) overlap factor at the interface is completely consistent with that of ITR, indicating that it can be used as an important parameter to explain the variation of ITR. The theoretical analysis of this study provides important theoretical guidance for the design of semiconductor devices with better thermal management performance.