A purple rabbit walks into a bar.

The bartender says, "I have some good news and some bad news for you."

"Oh no," says the rabbit. "Well, what's the good news?"

"You're immortal!"

"Wow, that's great news!" says the rabbit.

"And the bad news?" asks the rabbit.

"Well," says the bartender, "you will live forever."

This joke is funny because it is unexpected. You expect the bartender to give the rabbit some truly terrible news, like, perhaps, that its family has been murdered. But instead, the bartender reveals that the rabbit is immortal.

The fact that the bartender considers someone being immortal to be bad news is also unexpected, as many people would consider immortality to be a power, rather than a curse. And so the joke subverts your expectations, and this subverts your expectations of the punchline, and so it is funny.