Let’s Get Crazy
For centuries, doctors associated insanity and other medical afflictions with lunar cycles, hence the terms “lunatic” and “lunacy” to describe an affected person.
Since most nuts, like the human head, are hard with valuable contents, people have used “nut” as slang for “head” since at least the mid-1800s. The term “off his nut” described someone who seemed separated from his head and senses, and this was later shortened to just “nuts.”
An unpredictable and dangerous person is sometimes called a “loose cannon.” Early cannons of the wooden ship days were not yet secured in fixed spots, but were wheel-mounted and could be rolled to different gunports on the ship. When one of these extremely heavy guns broke loose on deck during high waves or battle, the “loose cannon” was a clear danger to nearby crewmen.