This slang expression for psychoanalyst (later exapanded to other psychotherapists as well as psychologists, and especially psychiatrists) probably evolved from comparison of psychoanalysis either to the aboriginal practice of shrinking actual heads or to phrenology.