A new drug delivery system loaded with the drug berberine on carboxymethyl chitosan-coated magnetic nanoparticles (Fe3O4@CMCS-BBR) was prepared and characterized through x-ray diffraction, Fourier transform-infrared spectroscopy, a vibrating sample magnetometer, and transmission electron microscopy. By comparing the size of the uncoated nanoparticles (39.26 nm) and the size of the coated magnetite nanoparticles (73.75 nm), it was found that with the CMCS coating on the magnetite nanoparticles, the dispersion of the nanoparticle improved. The optimum pH testing showed a higher drug encapsulation of 51.23% and drug loading of 17.10% at a pH of 5.5 because of the better interaction of the NH3+ group with the negative functional groups of the CMCS. Furthermore, 85.89% of the drug was released within 72 h. The CCK-8 test results showed that Fe3O4@CMCS-BBR magnetic nanocomposites had good biocompatibility with gastric cancer BGC-823 cells and that Fe3O4@CMCS-BBR effectively inhibited the proliferation of cancer cells. The magnetic experimental results showed that Fe3O4@CMCS-BBR had good responsiveness to external magnetic fields and aggregated in the presence of a magnetic field. The results of targeting experiments showed that fluorescein isothiocyanate emitted a strong yellowish fluorescence in cells, which became stronger over time, and the killing effect on cancer cells became greater. The apoptosis results showed that the apoptosis rate induced by the magnetic nanodrug was 54.90%, indicating that the drug had a promoting effect on the apoptosis of BGC-823 cells.