This work proposes a novel yet practical dragonfly optimization algorithm that addresses four competing objectives simultaneously. The proposed algorithm is applied to a hybrid system driven by the solid oxide fuel cell (SOFC) integrated with waste heat recovery units. A function-fitting neural network is developed to combine the thermodynamic model of the system with the dragonfly algorithm to mitigate the calculation time. According to the optimization outcomes, the optimum parameters create significantly more power and have a greater exergy efficiency and reduced product costs and CO2 emissions compared to the design condition. The sensitivity analysis reveals that while the turbine inlet temperatures of power cycles are ineffective, the fuel utilization factor and the current density significantly impact performance indicators. The scatter distribution indicates that the fuel cell temperature and steam-to-carbon ratio should be kept at their lowest bound. The Sankey graph shows that the fuel cell and afterburner are the main sources of irreversibility. According to the chord diagram, the SOFC unit with a cost rate of 13.2 $/h accounts for more than 29% of the overall cost. Finally, under ideal conditions, the flue gas condensation process produces an additional 94.22 kW of power and 760,056 L/day of drinkable water.