The g-C3N5 has been widely used in the field of environmental remediation because of its narrow band gap energy and good visible light absorption. It is an excellent semiconductor photocatalytic material, but the recombination of photogenerated carriers greatly limits the photocatalytic performance of g-C3N5. Construction of heterojunctions is an efficient method to regulate the band gap structure, which can achieve efficient separation of photogenerated carriers and improve photocatalytic performance. In this study, the TiO2/g-C3N5 heterojunction materials with high specific surface area were constructed, and the S scheme charge transfer mechanism led to efficient photogenerated carrier separation, excellent redox activity, improved visible light absorption and broadened spectral response range. After visible light irradiation for 30 minutes, the TiO2/g-C3N5 (1:2) showed excellent photocatalytic activity, and the degradation rate of sulfamethylthiazole (STZ) reached 98.8%. STZ was degraded to small inorganic molecules such as H2O, CO2 and inorganic acids by a complex bond-breaking hydroxylation reaction under the attack of reactive groups such as ·O2−,·OH and h+. The S scheme charge transfer mechanism of TiO2/g-C3N5 heterojunction material was proposed through band potential analysis and density functional function (DFT) calculation.