This article mainly discusses the optimization methods of machining parameters for CNC machine tools. Firstly, based on the functional requirements and application scenarios of CNC machining, three-dimensional modeling and motion simulation of twin machine tools are achieved, and a data-driven cutting process model is constructed. Then, in the actual production process, in addition to ensuring the normal processing of physical equipment such as CNC machine tools, the design of data perception schemes and the layout of data acquisition equipment during the processing were also completed, providing data support for information exchange between digital twins and real equipment. In terms of data transmission, the operation data of the entire CNC machine tool processing process is collected through the data perception layer equipment, and all perception data is then uploaded to the virtual space through the communication network of the transmission layer to drive the twin model for subsequent simulation, optimization, and prediction. Finally, based on the results of data collection, an objective function that needs to be optimized was established in the optimization process of CNC machining parameters. The objective function takes the total processing time and processing cost as optimization objectives, and an improved bee colony algorithm is used to solve the objective function. Through experimental simulation, it has been found that the use of CNC machine tool processing parameters can improve both time and processing costs, and the optimization results meet the design expectations.