This trope being Played for Laughs is at least Older Than Print! The giantess Skaði (or anglicized as Skadi), whose father was killed by the Aesir, goes to them demanding reparations. Among her demands is making her laugh. Loki tries his hand at the task...by tying his testicles to a goat's beard and proceeding to have a tug-of-war contest with the goat. You better believe Skaði couldn't avoid laughing then.
When Gaia the Earth was sick of her husband Uranus the Sky (who was also her son) ramming their children back into her womb (or in other versions of the myth, eating them) because he hated and feared them, she fashioned a sickle and asked her children to avenge her. The youngest and boldest one, Cronus, then took the sickle, and castrated his father when Uranus let his guard down. Uranus then cursed them with the name "Titans", or "Over-reachers".
The Greeks may have gotten this story from the earlier Hittite myth, in which Kumarbi bites off the testicles of the sky god Anu and gets pregnant from them.
Adonis was caught in a Love Triangle between Persephone and Aphrodite. Aphrodite won, and the jealous Persephone told Ares of Aphrodite's new lover. Ares turned into a boar and gored Adonis in the crotch.
Having murdered his brother Osiris, the Set dismembered the corpse. This included the severing of Osiris's penis, which was swallowed by a fish before Isis could find it and incorporate it into her late husband's reassembled body. He got better though after Isis created a new one for him out of ivory.
In the Book of Exodus, there is an oddly-specific law that states that if two men are fighting, and the wife of one of them attempts to put a stop to it by grabbing one of the fighting men's genitals, her hand is to be cut off as punishment for potentially rendering him sterile. (In this society, having children, especially sons, was a big deal, for both men and women. So by jeopardizing his ability to have children (or to have more children), she would be jeopardizing the estate of the man she grabbed, his status in society, his ability to worship in the temple (since men with crushed testicles were not permitted into the temple) and his old age (since elderly people were looked after by their adult children).) Presumably this punishment would also have applied to anyone else who did this, but this passage likely describes a very specific incident.
In the Books of Samuel, Saul agrees to let David marry his daughter Michal only if David brings him 100 Philistine foreskins. David goes above and beyond by bringing him 200 foreskins. Mercifully, some translations point out that he killed them first.