A nickname for Richard; later used as slang for detective and male genitalia.
Background
The use of 'dick' as a slang term for detective dates back to the late 19th century, likely derived from the nickname for Richard. Its use as slang for male genitalia became popular in the 20th century.