The removal of pharmaceutical contaminants from wastewater has gained considerable attention in recent years, particularly in the advancements of hydrogel-based adsorbents as a green solution for their ease of use, ease of modification, biodegradability, non-toxicity, environmental friendliness, and cost-effectiveness. This study focuses on the design of an efficient adsorbent hydrogel based on 1% chitosan, 40% polyethylene glycol 4000 (PEG4000), and 4% xanthan gum (referred to as CPX) for the removal of diclofenac sodium (DCF) from water. The interaction between positively charged chitosan and negatively charged xanthan gum and PEG4000 leads to strengthening of the hydrogel structure. The obtained CPX hydrogel, prepared by a green, simple, easy, low-cost, and ecological method, has a higher viscosity due to the three-dimensional polymer network and mechanical stability. The physical, chemical, rheological, and pharmacotechnical parameters of the synthesized hydrogel were determined. Swelling analysis demonstrated that the new synthetized hydrogel is not pH-dependent. The obtained adsorbent hydrogel reached the adsorption capacity (172.41 mg/g) at the highest adsorbent amount (200 mg) after 350 min. In addition, the adsorption kinetics were calculated using a pseudo first-order model and Langmuir and Freundlich isotherm parameters. The results demonstrate that CPX hydrogel can be used as an efficient option to remove DCF as a pharmaceutical contaminant from wastewater.