To be honest, I think its a thing some men like doing. I think they probably get off knowing someone is looking at them. Its not uncommon amongst certain primates to exert dominance by wiggling around an erect penis, regardless of whether the situation calls for it. We, at least us human males, are really not that much different.
I am pretty open about talking about sex and am not overly concerned if I 'offend' anyone by doing this. Obviously, I do not regale strangers with tales of my bedroom forays, but I like sex, I think about it a lot and so naturally I will talk about it with friends, male or female. A lot of females I have spoken to act a bit embarassed when discussing certain things, a lot of males seem more than willing to chat away. Its really nothing scandalous, its perfectly natural. Society has made certain conversation topics taboo and this is not one I can relate to.
But, if I was trying to go out with someone, I wouldn't start showing my dick or talking about how I like doggy style and handcuffs. That said, its been over a decade since I've dated so I really have no idea how the Modern Dating Human navigates this shit.
edit: Thought I would say that I don't think men are mentioning their crotch or showing their dick to "get girls talking". That's a delightfully naive way of putting it. Its a sex thing. Dicks are, that is.

:D