Green’s Dictionary of Slang

dick n.5

[? gypsy use dicked, being watched (cf. dekko n.), dick v.1 or abbr. SE detective; the link to the fictional Dick Tracy (created 1931) is chronologically impossible]
[1910s+] (US )

1. a police officer, usu. male.

2. a detective; thus house dick, the security officer in a hotel, office; store-dick a store detective etc.