A simple polyacrylamide gel method combined with low temperature sintering technology has been used to synthesize the C–O functional groups grafted MgAl2O4/C3N4/YMnO3 (MAO–CN–YMO) heterojunction photocatalysts with enhanced visible‐light‐induced photodegradation toward oxytetracycline hydrochloride (OTC‐HCl). A variety of characterization methods are used to gain insight into the phase purity, crystal structure, microstructure, functional group information, elemental composition, surface defect, light response capability, and photocatalytic activity of the as‐synthesized samples. The influences of the mass ratios of mCN/mYMO, mCN/mMAO, and mMAO/(mCN + mYMO) in CN–YMO, CN–MAO, and MAO–CN–YMO heterojunction photocatalysts on the photocatalytic activity for the degradation of OTC‐HCl was also discussed, and the optimal mass ratio of mMAO/(mCN + mYMO) is identified as 15 wt%. The photocatalytic experiments confirmed that the MAO–CN–YMO heterojunction photocatalysts had high selectivity for the degradation of antibiotics. The prediction of the photocatalytic activity of the MAO–CN–YMO heterojunction photocatalysts for the degradation of OTC‐HCl was made by a variety of intelligent algorithm models. The results of the whale optimization algorithm are highly consistent with the experimental results. Combined with the energy band theory and the characterization results of high‐performance liquid chromatography–tandem mass spectrometry, the free radicals in the reaction solution preferentially attacked the –CH3, –NCH2, and –OH of OTC‐HCl during the degradation of OTC‐HCl by MAO–CN–YMO heterostructure photocatalysts, and then attack –C=O and –C=O–NH2, and finally perform ring‐opening reaction to degrade OTC‐HCl into nontoxic and harmless products of small molecules such as CO2, H2O, and NH4+. This work provides a new idea for the development of novel double p–n junction MAO–CN–YMO heterojunction photocatalysts for antibiotic degradation and the prediction of photocatalytic activity of multiple heterojunction photocatalysts by intelligent algorithms.