bat-shit crazy, a. (often abbreviated to bat-shit)
Of persons : Not of sound mind, mad, insane, deranged, lunatic. Also to describe any state of frenzied rage, violence, excitement or intoxication. No longer in formal medical use.
Of ideas : To describe any bizarre, unfounded, heretical or otherwise objectionable belief or proposition.
For usage see e.g. 1390 Gower Conf. I. 46 For certes such a maladie, It myghte make a wisman batt shitte. 1507 Shakes Hamlet II.ii Pol : Mad call I it; for, to define true madness, what is't but to be bat-shit? 1910 S. Freud in Amer. Jrnl. Psychol. XXI. 193, I called this hypothetical state Fledermäuse-Scheiße (‘bat-shit’) and considered it was proved by the undeniable existence of resistance.
Of unknown derivation. Possibly :
1) A corruption of the term "batty", see also "bats in the belfry".
2) Relating to the hallucinatory effects of smoking the dried faeces of the Smoking Bat Amorphochilus schnablii.
3) A reference to the practice of the truly insane of batting their own shit around while making high-pitched screaming noises.
See also variants, e.g. ape shit and intensifiers, e.g. bat-shit on toast, with bells, on all fours, turning purple, flying, flying through the bat cave etc.
Sources : The Oxford English Dictionary, Second Edition; many awful lies of my own fabrication.