This paper mentions a new approach to accurately and fully describe the mathematical model of the automatic firing system of gas-operated machine guns. The mathematical model is established based on Lagrange's equations of the second kind. A numerical method was used to solve the research problem. The automatic firing system of the PKMS machine gun (of Russian origin) was selected for calculation and testing. After the research model is calculated, a comparison is made between the theoretical calculation results and the experimental results to verify the mathematical model. The comparison results between the calculation from the theoretical model and the results obtained from the experiment show that the mathematical model is suitable and reliable, the maximum velocity error of the bolt carrier is only 6.53%. The results obtained from this study are the basis for evaluating the working ability of the automatic firing system. This is also a reliable theoretical basis for designers to optimize the structure for automatic firing systems of gas-operated automatic weapons.