Question: what is it called when you like inflicting pain on yourself?
Answer: 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.