The effect of different port water injection (PWI) ratios on the knock in gasoline direct injection engines is explored. First, a simulation study is carried out under knock conditions to explore the time and location of the knock and the chemical mechanism that causes it. Second, water injection amount to 10%, 20%, 30%, and 40% are set to explore the effects of different water injection ratios on knocking. The influence of the different water injection ratios on the chemical mechanism of knocking is evaluated and that of the chemical mechanism on the in‐cylinder temperature and the impact of heat release rate (HRR) is explored. The results show that PWI can effectively reduce the occurrence of spontaneous combustion in the cylinder by reducing the flame propagation speed. On one hand, the changes in the low‐temperature reaction substances CH2O and HRR tend to be consistent and the peaks of CH2O and HRR move back with the increase in water injection. So, different ratios of PWI can affect the flame propagation speed by affecting the generation and consumption of CH2O, OH radicals, and HCO radicals. Also, PWI can significantly reduce the generation of in‐cylinder OH radicals, ultimately suppressing the generation of the high‐temperature stage. In addition, PWI can effectively reduce the mean temperature and mean pressure. Compared to other water injection ratios, a 30% water injection ratio is the most effective at inhibiting knocking. At this time, the knocking intensity is the lowest, and the cycle power reaches its maximum of 1120 J.