I think it helps that the HN userbase is primarily smart people who don't take kindly to gratuitous obnoxiousness and trolling. Most of the moderation is done by the community itself: cause trouble, and you get downvoted. The really egregious ones might get a response from mods.
I've noticed something similar on Ars Technica: again, you have a userbase of intelligent professionals, many of whom are long-term regulars. It's a culture that's naturally troll-resistant.
I think building this sort of culture on social media is a lot harder, because social media sites are typically focused on the exact opposite qualities: reflexive, drive-by responses; transient users who have no real investment in the community; and, overall, a userbase that's steeped in pervasive, unchecked toxicity and has started to enjoy it.