This study successfully prepared a novel green composite hydrogel based on carboxymethyl xylan and lignin with adjustable mechanical properties, high swelling, excellent UV shielding, and antioxidation performance. The structure and morphology of the hydrogel were characterized by Fourier transform infrared spectra, scanning electron microscopy, thermogravimetric analysis, rheological analysis, and swelling ratio. Results showed that lignin could significantly improve the mechanical properties of composite hydrogels. The compression stress and toughness of the composite hydrogel contained lignin increased by 39% and 60%, respectively, and the compressive deformation reached 90%. In addition, the addition of lignin increased the swelling ratio of the composite hydrogel reached 79.9 g/g. In addition, the composite hydrogel exhibited excellent UV shielding and antioxidation performance. The removal ratio of UV and free radicals is as high as 80% and 90%, respectively. The simple procedure and cost‐effective lignin as raw material for hydrogel with adjustable properties are favorable for medical‐biological applications.