Swarm intelligence algorithm is now a research focus for the energy optimization of fuel cell systems to improve hydrogen utilization efficiency. However, conventional algorithms exhibit poor robustness and low execution efficiency since complex constraints are involved in the fuel cell cathode purge process. Given that, this paper innovatively introduces chaotic mapping and dynamic learning mechanisms into the Salp swarm algorithm to enhance the algorithm's global search and local exploitation capabilities under complex constraints. First, we developed a three-stage nonlinear cathode purge model to describe the different water transfer behaviors in the three purging stages. Then, an optimizing function is created under the complex staged constraints to accurately reveal the energy consumption mechanism. Finally, the enhanced Salp swarm algorithm enables the rapid and accurate determination of the three-stage dynamic purge flows based on minimizing energy consumption. Compared with the fixed flow purge scheme, we found that energy consumption is reduced by 3.6 %–8.2 % under various constraints. The enhanced Salp swarm algorithm proposed in this work demonstrates an outstanding performance in the energy consumption optimization of fuel cell systems.