Why some pains are sweet? Some pains give pleasure not even bodily pains but mentally also in daily affairs, an individual may intentionally impose mild difficulties on his self. Is there a cognitive or evolutionary reason behind it or it is a disorder?
Endorphins and flow experience I suppose. Seems adaptive enough to have some mechanism for overcoming short-term distress for the sake of long-term gains, but like most things, this can be taken to extremes. There's some debate regarding the status of masochism within the normal–abnormal spectrum. See also internalization, which includes self-harm among other forms of maladaptation.