dick (n.)

"fellow, lad, man," 1550s, rhyming nickname for Rick, short for Richard, one of the commonest English names, it has long been a synonym for "fellow," and so most of the slang senses are probably very old, but naturally hard to find in the surviving records. The meaning "penis" is attested from 1891 in Farmer's slang dictionary (possibly British army slang). Meaning "detective" is recorded from 1908, perhaps as a shortened variant of detective.