Masochism is a medical condition. People who suffer from it can get pleasure from being hurt or humiliated by others. Often, the pleasure is sexual. When a person gets pleasure from being the one who causes hurt or humiliation, their condition is called Sadism.
The word "masochism" was invented by Richard von Krafft-Ebing, a German psychiatrist. He named it after Leopold von Sacher-Masoch (1836-1895), a writer whose books and stories often featured men in love with women who treated them cruelly.