The utilization of coal gangue as agricultural fertilizers is a universally applicable approach with high efficiency and added value. However, the limited nutritional efficacy and serious pollution risks prominently impede its development. The present study proposed a novel idea to simultaneously activate nutrients and remove pollutants in coal gangue through alkaline hydrothermal modification, yielding a highly active and eco-friendly silicon-based compound fertilizer enriched with silicon, potassium, organic matter and trace elements. The activation efficiency and mechanism on silicon and organic matter were systematically investigated, and the removal, migration and transformation rules for sulfur and heavy metals were also analyzed. The results demonstrated that undergoing a hydrothermal reaction under optimum condition increased the available SiO2 content by 320 times to 22.43%, while achieving a total K2O content of 13.30%. Additionally, the organic matter attained 13.68%, and labile organic matter was increased by 1.73 times. Moreover, the alkaline hydrothermal modification achieved a remarkable sulfur removal rate (up to 83.41%) and efficient heavy metal stabilization, which significantly diminished environmental risks. Modified coal gangue meets China National Standard for silicon-based compound fertilizers (NY/T 797–2004), thereby exhibiting substantial potential for agricultural applications and providing an innovative solution for sustainable utilization of coal gangue.