It probably sounds like some strange jargon when used as an insult.
The word connoted a person of questionable character long before it became a nickname for the penis. For example, in the 1665 satire The English Rogue by Richard Head, an unsavory character is referred to as a "dick":
Where do we end up when we save the world?