*Warning, a lot of crude language and mental images you don't need ahead*
Tormund Giantsbane is hilarious. He's so funny, it can be hard to see him as anything other than just the comic relief. He does play that role, especially in the rag-tag band that Jon Snow assembles to go north of The Wall in season 7 of Game of the Thrones. But Tormund is more than just the guy with the great jokes, and that stupid story about fucking a bear. Yes, he is that one character who constantly talks about penises that seems to be obligatory for HBO shows (at least since Spartacus, and Gannicus saying the word "cock" in every sentence). Tormund has more colorful words for the male genitalia, but almost everything that comes out of his mouth has something to do with sex. Not just jokes either, even in his more serious moments he's more often than not talking about sex: either giving advice to Jon Snow, or moaning about how Brienne won't notice him. But he isn't just a nymphomaniac: he doesn't have the nihilistic worldview. In fact, Tormund is the antidote to the depressing and cynical world he inhabits: and his seeming obsession with sex is part of that. He doesn't talk about sex the way that other men in Game of Thrones talk about sex. Even the "good" characters like Ned Stark talk about sex more often than not as a type of conquest: a way of asserting one's will over someone else. Most of the female characters talk about sex this way too, and experience it this way.
The negative and positive sides of this are explored in the characters of Sansa Stark and Margaery Tyrell. Sansa is on the receiving end of sex as conquest, not once but twice: strongly shaping her view of sexuality and marriage. She becomes frigid because she has been hurt, closing herself off from others. This even extends to people who can't be sex partners, including her sister Arya. Margaery Tyrell is on the perpetrating end. She uses sex as conquest to control Thommen Baratheon, getting him to idolize her by objectifying and coddling him. This is a problem ultimately, because when he is confronted with real responsibility he simply can't deal with it.
Even Danaerys was brought up thinking this way about sex, and all on her own discovered a different attitude towards sexuality. This is why the relationship with Daario Naharis is important to her character arc: he shows her the world of affirmative sexuality, completing her recovery from the trauma inflicted by her brother.
Jon is similarly hung up about his sexuality, because he believes he is a bastard. He is too genuinely kind to want to bring a child into the world who is going to suffer the way he has suffered. The only way he could express his sexuality was among the wildlings, where if Ygritte had a child by him then s/he would be treated the same as any other. At least, until his death and rebirth. At this point, his old identity as Eddard Stark's supposed bastard son is stripped away. He is simply Jon: not a bastard, not a brother of the Night's Watch, but a man. A man who can be a King. As the only (at that time known) surviving male in the Stark family, he is named King in the North: a position he could not have held if he were a bastard or a brother of the Watch. But these old positions in society have ceased to have meaning: because Jon has awoken to a broken world. Now Jon can begin to think of sex in a new light: not as a way of exerting control over someone, but as yet another way of helping others. Tormund is there to show him how that is accomplished.
You see, the reason why Tormund makes jokes is because Tormund wants to make people laugh. I know, I know, that sounds extremely obvious but if you think about it that makes him something almost miraculous in the world of GoT. Tormund, is a nice person. He just wants to make people smile. He's untouched by the Machiavellian machinations of the other characters. He has a nose for bullshit, and doesn't touch it with a ten foot pole. He doesn't care about his own advancement: he just wants people to be safe and laughing. Of course, this does actually get him advanced: to lead a band of wildlings. The way in which Tormund's way of talking about sex is different from the other characters is highlighted by the way he becomes the leader of that wildling band. Rattleshirt, like most of the men in this world, thinks of sex as conquest. He insinuates that Tormund plays the submissive role in sex with Jon i.e. that Jon has conquered Tormund. But let us contrast this moment with another before we examine Tormund's reaction. Sandor Clegane much later on insinuates that Tormund would submit to him in sex. In that case, Tormund reacts by misdirecting the conversation: he shows no sign of being offended, if anything he almost sounds interested (like I said, mental images you don't need). In the case of Rattleshirt however, Tormund goes ballistic and kills the guy. Why? because Rattleshirt is insinuating that Jon would enjoy dominating another man. This is an insult to Jon, a man so altruistic he's willing to die repeatedly for others. Tormund knows if he doesn't stand up for Jon, then no one will.
For all that Tormund talks about sex constantly, he doesn't actually do any. That isn't the point though. While everyone else is talking about death: Tormund is talking about life. Everyone else is unhappy, cynical and depressed: but Tormund is focusing on living, on finding joy in life and bringing that to others. He understands that it is especially now, as the long cold and dark winter full of horrors begins, that people like him are needed most. People kissed by fire, with red hair and sunny spirits. There's an even deeper layer to it as well. Sex is honest, you have to get naked to do it. You can't lie about who or what you are, to someone you're having sex with. Tormund talks about sex to show he's being honest: and to get others to be honest with him. It's a way to cut through the bullshit to find out who someone really is. Tormund understands something crucial that many people in this world don't seem to: flattery isn't complimentary, it's denigrating. Lying to someone about how good they are, or what they are capable of is an insult to that person. It's telling them that you think they are stupid enough to swallow your lie. When people start to deify Jon, Tormund quietly cuts through that: with a dick joke of course. This isn't just because it's Tormund's signature style. It's because joking about his penis reminds everyone that he has one: i.e. that he is a man. In fact it reminds everyone that the best and most wonderful thing about Jon, is that he is a man: not some theoretical divine being who cannot be truly known.
Of course, Tormund understands why people deify Jon. This is a world where men, especially men with power, routinely sacrifice others for their own self-interest. Here is Jon, who has already sacrificed himself for others and is willing to do so again. This is outside their understanding and expectations. But what Tormund is saying, is that Jon can be understood. He has motivations for doing what he does, which any of them could understand and relate to. Understand, relate to, and copy. People love and revere Jon because of his passionate commitment to serving others. But Tormund knows they could go beyond simply obeying his commands, bending the knee, or treating him with reverence. They could try to be more like him. They could try to put aside their selfish concerns, and see the larger picture. See the dangers posed by the oncoming winter and how they could use their resources to help more people than just their immediate family. Tormund isn't just lightening a tense and awkward moment, or saving Jon from embarrassment, he's making a radical statement about human nature. That's one deep dick joke right there.