Urban dictionary has it wrong. The origins come from those who used to gather the guano from caves as an ingredient for making gunpowder. The gatherers, in addition to being in the dark caves for days at a time, would often get infected with spores from a fungus which would attack, among other things, the central nervous system. This would sometimes result in bizarre and anti-social behaviour. Thus the term "batshit crazy"