Water pollution by toxic substances, such as dye molecules, remains a major environmental problem that needs to be solved. In the present work, the magnetic composite hydrogel based on the poly(2-(methacryloyloxy)-N-(2-hydroxyethyl)-N,N-dimethylethan-1-aminium bromide-co-N-isopropylacrylamide) copolymer with incorporated Fe3O4 particles ((poly(DMAEAB-co-NIPAm)@Fe3O4)) was prepared by an in situ synthesis technique for the efficient removal of dye molecules from water. The successfully synthesized magnetic hydrogel was characterized by FTIR, XRD, TGA, and TEM. The removal efficiency of the anionic dye bromophenol blue (BPB) and the cationic dye rhodamine B (RDM) by the prepared hydrogel adsorbents was evaluated. Various adsorption parameters, including the concentration of adsorbents and adsorption time, were also investigated. The results showed that the synthesized magnetic hydrogel had excellent BPB removal performance compared to the removal of RDM. The optimum adsorbent concentration for 0.5 mM BPB solution was approximately 0.5 g/L, and the removal efficiency was more than 99%. The kinetics data of BPB removal fitted well into the pseudo-2nd-order model, indicating that BPB dye adsorption involves chemical adsorption and physical adsorption. In addition, recycling studies were conducted to examine the reusability of the magnetic hydrogel for BPB removal for up to five cycles and the hydrogel could be reused without losing its high removal efficiency. The magnetic hydrogel poly(DMAEAB-co-NIPAm)@Fe3O4 with high removal efficiency, good selectivity, and reusability shows great potential for the removal of anionic dyes in wastewater treatment.