To solve a number of technological issues, it is advisable to use mathematical modeling, which will allow us to obtain the dependences of the influence of the technological parameters of chemical and thermal treatment processes on forming the depth of the diffusion layers of steels and alloys. The paper presents mathematical modeling of diffusion processes based on the existing chemical and thermal treatment of steel parts. Mathematical modeling is considered on the example of 38Cr2MoAl steel after gas nitriding. The gas nitriding technology was carried out at different temperatures for a duration of 20, 50, and 80 h in the SSHAM-12.12/7 electric furnace. When modeling the diffusion processes of surface hardening of parts in general, providing a specifically given distribution of nitrogen concentration over the diffusion layer’s depth from the product’s surface was solved. The model of the diffusion stage is used under the following assumptions: The diffusion coefficient of the saturating element primarily depends on temperature changes; the metal surface is instantly saturated to equilibrium concentrations with the saturating atmosphere; the surface layer and the entire product are heated unevenly, that is, the product temperature is a function of time and coordinates. Having satisfied the limit, initial, and boundary conditions, the temperature distribution equations over the diffusion layer’s depth were obtained. The final determination of the temperature was solved by an iterative method. Mathematical modeling allowed us to get functional dependencies for calculating the temperature distribution over the depth of the layer and studying the influence of various factors on the body’s temperature state of the body.