It happened to Jason Segel in real life, as he told Terry Gross for NPR's Fresh Air:
SEGEL: That was taken from the pages of real life. I once got dumped
while I was naked, but she asked me to put clothes on during this real
breakup, my real-life breakup, and as opposed to in the movie when I
say no, I did go to put clothes on. So she waited for me while I went
back into my room to get dressed. Let me just tell you, Terry.
GROSS: Yeah?
SEGEL: Picking out an outfit for the second half of a breakup is like
the hardest outfit you'll ever pick out in your life.
(LAUGHTER)
SEGEL: I came out - I came out in a blue button-up shirt and khaki
pants, like I was going to private school.
(LAUGHTER)
GROSS: So did it seem funny to you at the time, or was it just in
retrospect that - these things take on…
SEGEL: You know what? I think maybe this is the mind of a writer, I
guess. But it was - while this breakup is happening, which was
probably the most significant moment of my life to date, you know,
when that happened, and I'm naked, and the whole time I'm thinking
this is really, really funny. I'm going to use this in a movie
someday. And slowly her voice became like the teacher from Charlie
Brown, you know, just wha-wha-wha, wha-wha-wha (ph), while I was
slowly constructing the scene in my mind.
He also told the LA Times:
Segel also wrote the film's script, basing the scene on a real-life
naked breakup of his own. Still, the actor-writer contemplated
inequalities between male and female film nudity before putting his
family jewels on display.
"When a woman does nudity in a movie, men immediately switch into a
sexual mode," Segel said. "For women, from what I understand, it's not
like that. They see a naked, out-of-shape man crying and it's funny --
something weird, disturbing and disgusting we can all laugh at."
In that same article, Judd Apatow sees the scene as part of a larger "movement":
To hear him tell it, Apatow -- the comedy rainmaker behind "The
40-Year-Old Virgin" who has shown a Midas touch producing such jocular
male-skewing comedies as "Knocked Up," "Talladega Nights: The Ballad
of Ricky Bobby" and "Anchorman: The Legend of Ron Burgundy" -- has
made it a sort of personal mission to up the on-screen male member
quotient.
Call it a crusade to break down one of moviedom's last taboos. In the
2007 faux musical biopic he produced, "Walk Hard: The Dewey Cox
Story," Apatow positioned a penis behind the film's star John C.
Reilly's head during an orgy scene. The upshot: Some 20 audience
members reportedly stormed out of a test screening in disgust. As
well, the closing credits for another film Apatow produced, the teen
comedy "Superbad," feature a hilarious illustrated montage of male
sexual organs.
"America fears the penis, and that's something I'm going to help them
get over," Apatow is quoted as having said in a World Entertainment
News Service story in December. "I'm gonna get a penis in every movie
I do from now on. . . . It really makes me laugh in this day and age,
with how psychotic our world is, that anyone is troubled by seeing any
part of the human body."