This research focused on preparing hydrogels with controlled drug release properties to control gastrointestinal tract bacterial infection. Chitosan (CS) and polyvinylpyrrolidone (PVP) were used as the base polymers, with the CS component crosslinked by glutaraldehyde for hydrogel preparation using the solution casting technique. The effect of varying glutaraldehyde content in the hydrogels was characterized by the extent of swelling in simulated physiological fluids of pH 1.2, 6.8, and 7.4; the development of porosity; and gel fraction. Functional groups and covalent and hydrogen bonds formed, thermal stability, phase structure, and morphology were characterized by Fourier-transform infrared spectroscopy, thermogravimetric analysis, X-ray diffraction, and scanning electron microscopy. The results show that the components in the hydrogels have good compatibility and formed honeycomb-like structures. In vitro studies confirmed that the hydrogels have good biodegradability at pH 7.4. Based on these properties, a CS/PVP hydrogel of the ratio of 60 : 40 crosslinked with 600 μL glutaraldehyde was selected for the in-situ loading of 200 mg of the drug metronidazole (MTZ). The hydrogel was characterized for cumulative drug release in the simulated physiological fluids and drug release kinetics using different models and for its antibacterial activity. The best-fit Korsmeyer–Peppas model suggests that MTZ release followed diffusion and swelling-controlled time-dependent non-Fickian transport related to hydrogel erosion. This hydrogel displays enhanced antimicrobial activity against Staphylococcus aureus, and Escherichia coli showed substantial inhibition zones indicating the produced CS/PVP hydrogels are promising candidates for controlled drug release applications.