Algophily is a desire to experience pain for sexual gratification. Members of the BDSM community who identify as masochists are driven by algophily. You could also say that anyone driven by algophily, whether a member of the BDSM community or not, is an algophile.
The term is a combination of the words algo, meaning pain, and phily, from the Ancient Greek word for love, philia.
Algophily is sometimes called algophilia.