IIRC in America it was done as a supposed way to curb masterbation, and as time went on it instead stuck because nobody ever questioned it much.
People today still try to defend it with alleged hygiene and health benifits, mainly because people rarely take "your penis has somthing wrong with it" very well regardless of how kindly you phrase it.