This study meticulously brings forth significant insights into the efficacy of the potassium (K)-incorporated WO 3 / g-C 3 N 4 (K-WO 3 /K-gCN) system in facilitating electrocatalytic oxygen and hydrogen evolution reactions (OER and HER) in alkaline and acidic environments, respectively. The study found that the system achieved a minimum Tafel slope of 84 mV dec −1 for the OER and 25 mV dec −1 for the HER under illumination. The -C-N-K-linkage was found to greatly facilitate carrier transportation in gCN units. Additionally, the interfacial W↔N channels provide easy carrier migration pathways, leading to improved electrocatalytic performance in the system under visible light. We identified that for the OER, a unidirectional transfer of electrons takes place from N → W, i.e., from K-gCN to K-WO 3 , whereas for HER, the electron transfer takes place from W → N, i.e., K-WO 3 to K-gCN. These mechanisms were explained based on the S-scheme interfacial charge transfer processes in a heterojunction, where holes regulate the OER process, and electrons play a primary role in the HER. Additionally, the study identified C sites near nitrogen vacancies as responsible for initiating the OER and HER in the K-WO 3 /K-gCN system.