Digital twin (DT), machine learning, and industrial Internet of things (IIoT) provide great potential for the transformation of the container terminal from automation to intelligence. The production control in the loading and unloading process of automated container terminals (ACTs) involves complex situations, which puts forward high requirements for efficiency and safety. To realize the real-time optimization and security of the ACT, a framework integrating DT with the AdaBoost algorithm is proposed in this study. The framework is mainly composed of physical space, a data service platform, and virtual space, in which the twin space and service system constitute virtual space. In the proposed framework, a multidimensional and multiscale DT model in twin space is first built through a 3D MAX and U3D technology. Second, we introduce a random forest and XGBoost to compare with AdaBoost to select the best algorithm to train and optimize the DT mechanism model. Third, the experimental results show that the AdaBoost algorithm is better than others by comparing the performance indexes of model accuracy, root mean square error, interpretable variance, and fitting error. In addition, we implement empirical experiments by different scales to further evaluate the proposed framework. The experimental results show that the mode of the DT-based terminal operation has higher loading and unloading efficiency than that of the conventional terminal operation, increasing by 23.34% and 31.46% in small-scale and large-scale problems, respectively. Moreover, the visualization service provided by the DT system can monitor the status of automation equipment in real time to ensure the safety of operation.