This paper presents the results of establishing a predictive model and optimizing the surface roughness (SR) value when turning 40X steel using genetic programming (GP) algorithm and grey wolf optimization (GWO) algorithm. The regression equation is built by GP algorithm on the basis of 63 practical experiments with cutting parameters including rotary tool tilt angle, depth of cut, feedrate and cutting speed. The GWO algorithm is used to find the most suitable cutting parameters corresponding to the minimum SR value. Furthermore, the influence of these parameters on the SR value is also considered. The research results allow to evaluate the effectiveness of the algorithms used as well as the basis for improving the surface quality in dry turning with selt-driven rotary tool in some specific application cases.