I read years ago that muleteers of the Old West were such experts with their long whips that they could snap a horsefly from the ear of a mule in their team without touching the mule's ear. In such a man's hand, a whip could cut into a mule's tough hide; hence the name mule skinner.
John S. Farmer, Americanisms Old and New: A Dictionary of Words, Phrases and Colloquialisms (1889) includes this entry for mule skinner:
Mule skinner.—A plain's term for a driver of mules, in very truth the cognomen in some cases would bear literal translation.
And Stewart Sheldon, Gleanings by the Way, from '36 to '89 (1890) writes:
The crack of the lash, which sounded like a pistol under the manipulations of the expert, was sufficient, so that the terms "bull whacker" and "mule skinner" were anomalous, only as applied to less progressive and more brutal drivers, of whom a sufficient number still remained.
As Matt Эллен notes in his response to the poster's question, the first citation for mule-skinner is John H. Beadle's Life in Utah; or, The Mysteries and Crimes of Mormonism (1870)—a book whose publisher touts it on the title page as "being an exposé of the secret rites and ceremonies of the Latter-Day Saints, with a full and authentic history of polygamy and the Mormon sect from its origin to the present time." In the book, Beadle writes that mule-driving "mule-skinners" and oxen-driving "bull-whackers" had different levels of social status on the range:
The "mule-skinner" considers the "bull-whacker" quite beneath him, and will hardly associate with him upon equal terms, while the latter doubtless looks upon the former as 'stuck up' and proud.
The earliest mention of bull whacker I found in a Google Books search was in a January 1861 article for Hunt's Merchant Magazine and Commercial Review titled "Commerce of the Prairies," by an uncredited author:
Washing and combing are looked upon as superfluities by the genuine "bull whacker."
A close second is Thomas W. Knox's article, "To Pike's Peak and Denver," for the August 1861 issue of The Knickerbocker magazine:
Five yoke of oxen is the motive power for each wagon, and these are urged forward by a 'bull-whacker' armed with a whip, carrying a lash from six to twelve feet in length, which makes its mark wherever it falls.
To these two categories of drivers, George A Crofutt, Crofutt's New Overland Tourist and Pacific Coast Guide (1884) adds a third: "burropuncher."
The Indian troubles of last year [in the Arizona Territory] have tended to make, not only every soldier, but every teamster, wood chopper, burropuncher, mule-skinner, bull-whacker and all other men—traveling arsenals; with a belt about the waist loaded with cartridges, a pair of six-shooters, a formidable knife and a rifle for long range.
I haven't come across a comparable name for a horse driver, indicating perhaps that horses were more tractable than bulls, mules, and burros.
OED's definition #5 for cracked...
Of the brain, mind, etc.: Unsound, impaired, somewhat deranged.
Of a person: Unsound in mind, slightly insane, crazy.
...for which the first relevant citation is...
1610 Bp. J. Hall Common Apol. against Brownists xxvii. 68
That which this man was wont so oft to obiect to his brother (a crack't braine).
As to the specific conjunction crackpot, I think it's worth noting that -pot is appended to various other "fused words" applied (usually, negatively) to people - moneypots, honeypot, fusspot, tosspot.
I think it's fairly obvious that crack't/cracked in this context is just a slightly more figurative way of saying broken, not functioning properly. Per @Oldcat's comment below, additional -pot component could be interpreted as head, brain, skull. Or it may be simply added for prosody (or by association with related forms), and not really add any specific extra meaning.
Best Answer
Joachim is probably on the right track. In support of his suggestion:
[PersonalityPsychology_guides]
The usage would thus be metaphor (though Hippocrates would have seen it as metonymy).
It is possible, however, that 'unbalanced judgements' (ie not properly thought out and weighted) could have informed the usage:
[Online Etymology Dictionary] [emphasis mine, EA]
'Maladjusted' though refers to a person's adaptiveness to their social environment.