In this study, SWCNT/ZnO/Fe3O4 heterojunction composite was prepared for enhancing the degradation of β-lactam drugs such as cefixime (CFX) from an aqueous solution. The effects of several factors such as pH, initial concentration of CFX, and photocatalyst dose were investigated. Among them, pH was the most effective parameter for the degradation of CFX. Pareto graph revealed that the degradation process was accelerated at acidic conditions. The surface morphology test such as scanning electron microscopy (SEM) was applied to enlighten the surface of the functionalized SWCNT/ZnO/Fe3O4 photocatalyst. Highly advanced analyzes such as X-ray Photoelectron Spectroscopy (XPS), Energy Dispersive Spectrometry (EDX), Fourier-Transform Infrared Spectroscopy (FTIR), X-ray Diffraction (XRD), and point of zero charge were included to explain the structure of the photocatalyst. The response surface methodology's results show that the optimum CFX efficiency was fully achieved at 94.19%. The optimal conditions with lower standard error (2.08) were given as pH of 5.93, 22.76 ppm of CFX, and 0.46 g L−1 of the amount of photocatalyst. Besides, the obtained photocatalyst can be easily used many times owing to its high reusability. SWCNT/ZnO/Fe3O4 photocatalyst might be recommended to be used for the mineralizing of drug compounds such as antibiotics in water. Moreover, thiazol-2-ol, N-(dihydroxymethyl)-2-(2-hydroxythiazol-4-yl)acetamide,(S)-N-(2-amino-1-hydroxy-2-oxoethyl)-2-(2 hydroxythiazol-4-yl), and 2-(2-hydroxythiazol-4-yl)-N-((2R,3R)-2-mercapto-4-oxoazetidin-3-yl)acetamide were among the detected intermediates products from the cefixime degradation in the process.