The present study introduces an economical–functional design for a polymer electrolyte membrane fuel cell system. To do so, after introducing the optimization problem and solving the problem based on the presented equations in the fuel cell, a cost model is presented. The final design is employed for minimizing the construction cost of a 50 kW fuel cell stack, along with the costs of accessories regarding the current density, stoichiometric coefficient of the hydrogen and air, and pressure of the system as well as the temperature of the system as optimization parameters. The functional–economic model is developed for the studied system in which all components of the system are modeled economically as well as electrochemically–mechanically. The objective function is solved by a newly improved metaheuristic technique, called converged collective animal behavior (CCAB) optimizer. The final results of the method are compared with the standard CAB optimizer and genetic algorithm as a popular technique. The results show that the best optimal cost with 0.1061 $/kWh is achieved by the CCAB. Finally, a sensitivity analysis is provided for analyzing the consistency of the method.