Due to the increase in pollutants produced by fossil fuels, the earth's ecosystem has been threatened, and actions must be taken to improve the current situation. One of these actions is using renewable energies instead of fossil fuels, and another is using multigenerational production systems instead of single-product-oriented systems. This study investigated a geothermal system with two ejector cooling cycles combined with an improved ORC cycle with a fuel cell that can produce hydrogen by consuming production power. After performing the numerical simulation, the system's energy efficiency is 40.25%, and the exergy efficiency of the system is 22.52% for the geothermal source, which produces 6143 kW of thermal energy. The net output power of the whole system is equal to 344.1 kW, the production cooling load is equal to 2214 kW, and the hydrogen production rate is 2.369 kg/h. The amount of exergy destruction of various equipment in the cycle has been calculated and verified. Also, a parametric analysis was done based on the effect of different points' thermodynamic characteristics on the system's main parameters, such as net output power, energy and exergy efficiency, the total cost of unit power cost, sustainability index, and the results were analyzed. Also, a genetic algorithm has optimized the study cycle, and a multi-objective optimization analysis has been presented, with the objectives of the cycle's sustainability index, exergy efficiency, and power production cost rate.