Green’s Dictionary of Slang

box n.3

[abbr. SE colloq. brainbox]

[late 19C–1900s; 1970s+] the brain, the head.

In phrases

out of one’s box (adj.)

1. [1900s; 1990s+] (also off one’s box, out of the box) mad, eccentric, beyond emotional restraint; also attrib.

2. [1970s+] (also off one’s box, off one’s pot) completely intoxicated, whether by drink or drugs.