Automated guided vehicle (AGV) scheduling and routing are critical factors affecting the operation efficiency and transportation cost of the automated container terminal (ACT). Searching for the optimal AGV scheduling and routing plan are effective and efficient ways to improve its efficiency and reduce its cost. However, uncertainties in the physical environment of ACT can make it challenging to determine the optimal scheduling and routing plan. This paper presents the digital-twin-driven AGV scheduling and routing framework, aiming to deal with uncertainties in ACT. By introducing the digital twin, uncertain factors can be detected and handled through the interaction and fusion of physical and virtual spaces. The improved artificial fish swarm algorithm Dijkstra (IAFSA-Dijkstra) is proposed for the optimal AGV scheduling and routing solution, which will be verified in the virtual space and further fed back to the real world to guide actual AGV transport. Then, a twin-data-driven conflict prediction method is proposed to predict potential conflicts by constantly comparing the differences between physical and virtual ACT. Further, a conflict resolution method based on the Yen algorithm is explored to resolve predicted conflicts and drive the evolution of the scheme. Case study examples show that the proposed method can effectively improve efficiency and reduce the cost of AGV scheduling and routing in ACT.