Since the number of containers in automated container terminals (ACTs) has been growing, the operation of ACT relies on a large amount of electric power, which comes from the terminal energy system. As the main horizontal transportation equipment in ACTs, the scheduling of automated guided vehicles (AGVs) has become increasingly important. Even though AGV scheduling has been studied, the battery-swapping procedure is often overlooked, which hinders operation efficiency and the usage of renewable energy. We propose a co-optimization problem of the operation and energy for AGVs considering battery-swapping in this paper. A multi-objective model is constructed to minimize the makespan of AGVs and the operation and maintenance cost of energy system. In addition, we create a discrete multi-objective whale optimization algorithm to address this co-optimization problem. A load-balancing-based method for population initialization is developed to make the distribution of solutions more uniform in this algorithm. With the two-dimensional matrix encoding scheme, an individual right-shifted method is proposed for decoding. The best solution is assessed and selected through a fitness evaluation mechanism based on fuzzy correlation entropy. The bubble-net attack based on opposition-based learning is implemented to enhance the capacity for local intensification. Numerous tests confirm that the proposed method can guarantee the operation efficiency, lower the total cost of the energy system, and promote sustainable development in ACTs.