How did the phrase "are you nuts" come about?
What is the connection between "nut" and the character? How was the phrase "are you nuts?" used at first?
Etymonline has this to offer:
"crazy," 1846, from earlier be nutts upon "be very fond of" (1785), which is possibly from nuts (n., pl.) "any source of pleasure" (1610s), from nut (q.v.). Sense influenced probably by metaphoric application of nut to "head" (1846, e.g. to be off one's nut "be insane," 1860).
So, in a similar since of being out of one's mind or being out of your head, nuts seems to have evolved past into its own idiom. This is further suggested by the common phrase, "out of one's gourd" which has the same meaning.
Etymology Online contends that nuts was influenced by the metaphoric application of nut to refer to one's head. To be off one's nut dates from 1861 as an expression for "to be insane". Similarly, one could say "to be out of mind" or "to be out of one's head". In British English, a crazy person is a nutter (possibly antiquated).
Also of note: nuts to mean "crazy" predates the usage of the same to mean testicles (1846 and 1915, respectively).
Alice Nutter was one of the 'witches' tried at the Pendle Witch Trials of 1612 in Pendle, Lancashire, England.
The trials of the Pendle witches in 1612 are among the most famous witch trials in English history, and some of the best recorded of the 17th century. The twelve accused lived in the area around Pendle Hill in Lancashire, and were charged with the murders of ten people by the use of witchcraft. (...) Alice Nutter was unusual among the accused in being comparatively wealthy, the widow of a tenant yeoman farmer. She made no statement either before or during her trial, except to enter her plea of not guilty to the charge of murdering Henry Mitton by witchcraft.
The word 'nutter' could be from this as she was seen to be 'crazy', therefore "are you nuts?"/"nut-case"/"off one's nut" could have evolved from this.