In Buddhism, it is mudita, มุทิตา in Thai language:
The more deeply one drinks of this spring, the more securely one becomes in one's own abundant happiness, the more bountiful it becomes to relish the joy of other people.
There are no common words in English as the opposite of jealousy or envy. Which is not surprising in a culture of compulsory monogamy. Even though non-monogamous relationships are more ethically correct being that the participants made that choice in their own will, and not under social, cultural or moral pressure as is the case for monogamous lifestyles. If you are skeptical about that last statement, think about the frequency of cheating in monogamous relationships. And if you think that non-monogamous lifestyles are abnormal, think of the following statement:
Compulsory monogamy is an accurate comparison to compulsory heterosexuality because they are both institutionalized. Source: Against Compulsory (Non)Monogamy, in Psychology Today.
So for lack of a suitable word, someone came up with compersion as the opposite of jealousy. Most reference the origin to the Kerista community, in the 1971-1991 period. It could have been mudita just as well as it means precisely that.
It is not easy to feel compersion
Evidently Buddha knew that mudita, or joy, is traditionally regarded as the most difficult to cultivate of the four immeasurables. Jealousy feelings are strong obstacles to feeling mudita. So, what is jealousy then? Jealousy is the fear of losing something one has or even never had in the first place. Insecurity, or fear, is what causes Jealousy. Feeling jealousy when a partner is getting attention from someone else is because of personal or relationship insecurity, the fear of losing that partner to someone else.
There we are … bullseye on jealousy in relationships “the fear that someone else is better and could take my partner from me”. Seeing your partner having pleasure with another person brings up feelings of either jealousy or compersion, depending on how secure and confident you are about yourself. Important detail: confident about yourself, not about your partner. Because you are the one with the feelings, not your partner who is having a great time with that other person.
So, let’s break it down: why do you feel jealousy? Do you feel that you have ownership or exclusive rights of your partner? Ownership of a partner in today’s world of equality is really outdated and you should seriously consider if your morals are compatible with human ethics. Or is it because you are insecure about that relationship? Do you fear losing your partner to someone “better”? Or is it that you fear that you are less than you need to be to retain a relationship with that partner and you fear that someone else would be better than you? Truth is that most breakups have little or nothing to do with outside influence or person. Most relationships end simply because one or both partners perceive that it is no longer beneficial to them, expressed in boredom and diminishing emotions toward each other. It is less commonly due to an outside interference like that of someone else scooping up your partner from under your nose.
How to get there?
But how do you get to feel compersion naturally and spontaneously? Love and care without reservation, where you are happy when your partner feels happiness and enjoys pleasure AND recognizes that you are not the exclusive one who provides that. Trust your relationship knowing that your partner will come back to you with a big smile expressing the pleasure and happiness just experienced. That simply put is compersion.