To address the anti-swing issue of the payload in bridge cranes, Proportional–Integral–Derivative (PID) control is a commonly used method. However, parameter tuning of the PID controller relies on empirical knowledge and often leads to system overshoot. This paper proposes an Improved Sparrow Search Algorithm (ISSA) to optimize the gains of PID controllers, alleviating adverse effects on payload oscillation and trolley positioning during the operation of overhead cranes. First, tent map chaos mapping is introduced to initialize the sparrow population, enhancing the algorithm’s global search capability. Then, by integrating sine and cosine concepts along with nonlinear learning factors, the updating mechanism of discoverer positions is dynamically adjusted, expediting the solving process. Finally, the Lévy flight strategy is employed to update follower positions, thereby enhancing the algorithm’s local escape capability. Additionally, a fitness function containing overshoot penalties is proposed to address overshoot issues. Simulation results indicate that the overshoot rates of all algorithms remain less than 3%. Moreover, compared with the Sparrow Search Algorithm (SSA), Particle Swarm Optimization (PSO), Simulated Annealing (SA), and Whale optimization Algorithm (WOA), the optimized PID control system with the ISSA algorithm exhibits superior control performance and possesses certain robustness and adaptability.