It is imperative to switch from energy sources based on fossil fuels to environmentally friendly alternatives to meet sustainable development goals. Green hydrogen has become a viable option for achieving this goal. The necessity for extreme purity, limited water supplies, and more expensive procedures are major obstacles to the hydrogen economy. This work has investigated the use of transition metal-based HfCoS/rGO electrocatalyst to produce green hydrogen from wastewater. The suggested electrocatalyst has shown good performance in producing hydrogen and oxygen. With excellent durability, it only takes 1.6, 1.64, and 1.73 V for deionized water (DI), tertiary effluent (TE), and raw wastewater (RWW), respectively, to reach 10 mA/cm 2 of current density. During the electrolysis process, contaminants were effectively eliminated in addition to producing green energy. The removal of chemical oxygen demand (COD) was 37.4% and 24.6% for RWW and TE. Similarly, 39.2% and 27.8% total nitrogen (TN) was removed for RWW and TE during wastewater electrolysis. A new window of opportunity for establishing a sustainable hydrogen economy and water management techniques is created by substituting low-grade water for high-purity water.