Intelligent manufacturing is the main direction of Industry 4.0, pointing towards the future development of manufacturing. The core component of intelligent manufacturing is the computer numerical control (CNC) system. Predicting and compensating for machining trajectory errors by controlling the CNC system’s accuracy is of great significance in enhancing the efficiency, quality, and flexibility of intelligent manufacturing. Traditional machining trajectory error prediction and compensation methods make it challenging to consider the uncertainties that occur during the machining process, and they cannot meet the requirements of intelligent manufacturing with respect to the complexity and accuracy of process parameter optimization. In this paper, we propose a hybrid-model-based machining trajectory error prediction and compensation method to address these issues. Firstly, a digital twin framework for the CNC system, based on a hybrid model, was constructed. The machining trajectory error prediction and compensation mechanisms were then analyzed, and an artificial intelligence (AI) algorithm was used to predict the machining trajectory error. This error was then compensated for via the adaptive compensation method. Finally, the feasibility and effectiveness of the method were verified through specific experiments, and a realization case for this digital-twin-driven machining trajectory error prediction and compensation method was provided.