Methacrylated biopolymers are unique and attractive in preparing photocrosslinkable hydrogels in biomedical applications. Here we report a novel chitosan (CS) derivative‐based injectable hydrogel with anti‐inflammatory capacity via methacrylation modification. First, ibuprofen (IBU) was conjugated to the backbone of CS by carbodiimide chemistry to obtain IBU‐CS conjugate, which converts water‐insoluble unmodified CS into water‐soluble IBU‐CS conjugate. The IBU‐CS conjugate did not precipitate at the pH of 7, which was beneficial to subsequent chemical modification with methacrylic anhydride to prepare IBU‐CS methacrylate (IBU‐CS‐MA) with significantly higher methacrylation substitution. Photocrosslinkable in situ gel formation of injectable IBU‐CS‐MA hydrogel was verified using lithium phenyl‐2,4,6‐trimethylbenzoylphosphinate (LAP) initiator under visible light. The IBU‐CS‐MA hydrogel showed good cytocompatibility as revealed by encapsulating and in vitro culturing murine fibroblasts within hydrogels. It promoted macrophage polarization toward M2 phenotype, as well as downregulated pro‐inflammatory gene expression and upregulated anti‐inflammatory gene expression of macrophages. The hydrogel also significantly reduced the reactive oxygen specifies (ROS) and nitrogen oxide (NO) produced by lipopolysaccharides (LPS)‐stimulated macrophages. Upon subcutaneous implantation in a rat model, it significantly mitigated inflammatory responses as shown by significantly lower inflammatory cell density, less cell infiltration, and much thinner fibrous capsule compared with CS methacrylate (CS‐MA) hydrogel. This study suggests that IBU‐CS conjugate represents a feasible strategy for preparing CS‐based methacrylate hydrogels for biomedical applications.