Predicting the system efficiency of green energy and developing forward-looking power technologies are key points to accelerating the global energy transition. This research focuses on optimizing the parameters of proton exchange membrane fuel cells (PEMFCs) and photovoltaic (PV) cells using the honey badger algorithm (HBA), a swarm intelligence algorithm, to accurately present the performance characteristics and efficiency of the systems. Although the HBA has a fast search speed, it was found that the algorithm's search stability is relatively low. Therefore, this study also enhances the HBA's global search capability through the rapid iterative characteristics of spiral search. This method will effectively expand the algorithm's functional search range in a multidimensional and complex solution space. Additionally, the introduction of a sigmoid function will smoothen the algorithm's exploration and exploitation mechanisms. To test the robustness of the proposed methodology, an extensive test was conducted using the CEC'17 benchmark functions set and real-life applications of PEMFC and PV cells. The results of the aforementioned test proved that with regard to the optimization of PEMFC and PV cell parameters, the improved HBA is significantly advantageous to the original in terms of both solving capability and speed. The results of this research study not only make definite progress in the field of bio-inspired computing but, more importantly, provide a rapid and accurate method for predicting the maximum power point for fuel cells and photovoltaic cells, offering a more efficient and intelligent solution for green energy.