“All unhappiness,” says the Bhagavad Gita, “is a result of false expectations.”
I might add that it can also be a result of habit. I would never have understood this when younger, but once habituated to unhappiness, the habitué might well, given a choice between happiness and unhappiness, willfully choose unhappiness simply because that has become their comfort zone. Thus, when the Swedish mystic, Emanuel Swedenborg (1688-1782), was permitted to visit heaven and hell, he learned that in the afterlife all people choose for themselves whether to go to heaven or hell, based on the preferences they’ve become accustomed to in life.
Related: Pleasure and Happiness, Good Angels and Bad