1650s, "melancholy," from French chagrin "melancholy, anxiety, vexation" (14c.), from Old North French chagreiner or Angevin dialect chagraigner "sadden," of unknown origin, perhaps [Gamillscheg] from Old French graignier "grieve over, be angry," from graigne "sadness, resentment, grief, vexation," from graim "sorrowful," of unknown origin, perhaps from a Germanic source (cf. Old High German gram "angry, fierce"). But OED and other sources trace it to an identical Old French word, borrowed into English phonetically as shagreen, meaning "rough skin or hide," of uncertain origin, the connecting notion being "roughness, harshness." Modern sense of "feeling of irritation from disappointment" is 1716.
1660s (implied in chagrined), from chagrin (n.). Related: Chagrined; chagrining.