A headshrinker, like the people who created shrunken heads. It’s slang. A joke, sort of. As if a psychiatrist were literally a kind of witch doctor who performed drastic modifications on your brain.
As far as I know, the expression came into use in the 1960s, first just the long form and later shortened. Before that, most people didn’t have anything to do with mental health professionals and mental illness was a condition seldom talked about. During those strange times it started to become fashionable and even “normal” to have a therapist and discuss it openly. Treating the label in a jocular way helped minimize the stigma and the serious implications of having a diagnosable mental health condition. At the time, the DSM was not well known or in widespread use, and everyone you knew didn’t have a condition that was listed in there somewhere.