If you call someone a masochist, you either mean that they take pleasure in pain, or — perhaps more commonly — that they just seem to.
Masochism is an eponym — a word named for a person. Leopold von Sacher-Masoch was an Austrian writer in the nineteenth century who described the gratification he got from his own pain and humiliation. There are many self-proclaimed masochists out there today — and, one would have to imagine, at least as many sadists, those who enjoy inflicting pain on others (from the name of the Marquis de Sade). But these days you're most likely to hear the word used jokingly by someone who doesn't understand another's motivations for doing something painful or difficult: "You're still building that stone wall? What are you, some kind of masochist?"