Hydrogen fuel cell is an ideal energy device, but to choose its power output capacity and characteristics, it is necessary to establish a mathematical model and simulation analysis. In this paper, firefly algorithm is introduced to find the optimal solution of model parameters within a given constraint range, and a more effective way is proposed to optimize the performance by changing the structure and working parameters of the fuel cell. In order to verify the correctness of the model parameters, a set of Simulink simulation model was built to meet the actual parameters, and the verification simulation was carried out. The simulation results were basically consistent with the real stack.