Abstract In this study, phosphorus‐doped g‐C 3 N 5 photocatalyst was synthesized by the thermal polycondensation method using 1‐Hydroxyethylidene‐1,1‐diphosphonic acid (HEDP) as the phosphorus source. The photoelectrochemical and photocatalytic performance of the catalyst were investigated through the characterization and analysis of its morphology, structure and photoelectric performance, as well as the discussion of the photocatalytic degradation mechanism. The results show that compared with undoped g‐C 3 N 5 , phosphorus doping can significantly enhance the specific surface area of g‐C 3 N 5 , reduce its band gap width, and expand its visible light absorption range. It can be substantiated that the phosphorus‐doped g‐C 3 N 5 exhibits enhanced photocurrent response characteristics and a superior photocatalytic degradation efficiency. The degradation of tetracycline hydrochloride (TC‐HCl) was observed to occur rapidly and completely within 60 min under visible light irradiation. This considerable enhancement can be attributed primarily to the substitution of phosphorus into carbon sites through the formation of P‐N/P = N bonds with four coordination, which introduces additional P 2p levels within the band gap as a donor state, thereby facilitating enhanced light absorption and reducing charge separation. DFT calculations were conducted to analyze the electronic properties of P‐doped g‐C 3 N 5 and to ascertain the mechanism by which P doping enhances the photocatalytic activity of g‐C 3 N 5 .