The advancement of potent, highly efficient and reasonably priced catalysts is necessary for the production of hydrogen from a renewable source and removal of organic contaminants from waste water. In this study, we demonstrated the dynamic proportion capability of the hydrothermally condensed polymorphic electrocatalyst MgCo2O4/PANI nanocomposite. The composite material has higher surface area of 264 m2 g-1 and electrochemical active surface area of 299.5 cm2. The MgCo2O4/PANI nanocomposite exhibits 201 mV of lower overpotential to attain at 10 mA cm-2 of current density and 66 mV dec-1 of reduced Tafel value. The long-term viability for 50 h is demonstrated using MgCo2O4/PANI at 10 mA cm-2 for O2 production. The findings of this study demonstrated that MgCo2O4/PANI nanocomposite is an affordable, non-precious material, which can be utilized to generate H2 on a large scale. On the other hand, the resultant material was then applied for the Congo Red (CR) dye photodegradation irradiated with visible light with degradation efficiency of 98%. The comparison of nanostructured MgCo2O4/PANI demonstrates that the electrochemical performance for water oxidation processes as well as degradation process is significantly higher than the pure form. The exceptional catalytic performance of MgCo2O4/PANI nanocomposite is due to the large quantity of active sites, some immense oxygen vacancies, and a fast electron transfer rate, with a steady oxygen generating stability of 1500 cycles confirm the endurance of MgCo2O4/PANI nanoarrays, which is beneficial for future industrial application.