The reason why men do that is because it is a bad habit and most of the times the package is not in a comfortable position after sitting or walking so we have to make it lay or hang in a comfortable position.Women like to play with their hair and men play with their jewels.
I think it's a bit of a comfort / reassurance thing. Like the way a child might suck their thumb or have a safety blanket or something. Guys seem to do it more when they are nervous, stressed or tired.