Finite element models offer a promising approach for modelling induced residual stresses to maintain part quality in machining. The study employed Analysis of Systems software to develop a 3D model that minimizes residual stress in annealed AISI 1040 carbon steel and optimizes machining parameters. The experimental tests using an X-ray diffractometer were conducted to measure both superficial and in-depth residual stress. The material behaviour, friction, and flow stresses were modelled using the Johnson-Cook model. The cutting parameters considered as variables were cutting speed, feed rate, and depth of cut, which were optimized using response surface methodology (RSM). The study analyzed the superficial stresses obtained from simulation and experimental tests, with average values of - 330.1 MPa and - 326.4 MPa, respectively, across 27 trials. The comparison demonstrated a high level of consistency between the two sets of results, with percentage errors ranging from 0.43% to 2.21%, underscoring the accuracy and reliability of the FE model. The optimal cutting parameters for achieving the lowest residual stress level (- 136.23 MPa) were a cutting speed of 138.94 m/min, a feed rate of 0.588 mm/rev, and a depth of cut of 0.282 mm. The proposed FE model offers a potential solution to minimizing residual stresses during the machining of carbon steels.