from Xara: why does crackpot mean a lunatic?

In that context, I suspect, the pot is the headbone, and since it's cracked the brains are leaking out and therefore not working quite right... You weren't by any chance cooking brains for dinner, were you?
(Crack of course has now evolved to have other meanings associated with making the brain not work right, too.)

And "lunatic" comes from the days when the mental processes (among other things) were supposed to be affected by the moon, with or without its phases (just going through a phase, dont y'know), so that the insane were considered to be moonstruck and were not infrequently consigned to the loony bin.

Nowadays of course we know better (I think) but the language doesn't change nearly as fast as the state of our knowledge.