Unhinged literally means a door taken off its hinges. A gate, a lid, a cabinet: something built to swing on a fixed point, now no longer attached to it. The thing still moves, but in any direction. There is no axis. There is no return. That is the picture the word started with, and the picture is doing all the work.
The literal sense is recorded in English by around 1610. The figurative jump came almost as soon as the literal sense was steady: by 1722 unhinged was already being used for a mind that had come off its frame. The metaphor must have been instantly legible. A hinged door is a model of constrained motion: the thing moves, but only along one trusted arc. A mind without hinges is a mind that can swing into anything.
From clinical to compliment
For most of its history the word was diagnostic, and not affectionately so. To call someone unhinged was to say their reasoning had detached from whatever had been holding it in place. The cousins were deranged, unbalanced, broken. A thesaurus from 1900 would have grouped it with words a doctor used about a patient.
That has shifted. Sometime in the last decade or so, mostly online, unhinged became something you could be on purpose. "Unhinged energy", "unhinged behaviour", "this thread is unhinged": the tone is approving. The word now describes a particular flavour of public boldness, speaking past the hinge of polite expectation, without obvious anchor, and finding that there is an audience for it.
This is not new for English. Words slide between clinical and admiring all the time. Crazy runs both directions in a single sentence. Mad used to mean angry, then mentally ill, then talented (a "mad genius"). Unhinged has joined the same drift. The word still names the mechanism, a swing without an axis, but the value attached to that swing has flipped depending on who is watching.
The hinge that does the work
The cleverness of the metaphor sits entirely in the hinge. Take any other piece of hardware as the source: unscrewed, unbolted, unlatched. The figurative reach is much narrower. Unscrewed implies sloppiness; unbolted implies escape; unlatched implies access. Only the hinge gave English a way to picture a mind that still moves but no longer along the path it was built for.
Spanish, as it happens, picked the same piece of hardware for the same metaphor: desquiciado, off its quicio, the pivot post a door turns on. Two languages reached for the same image to name the same thing. Sometimes a metaphor travels well because the picture underneath is too good to pass up.
That is the small thing the word holds onto, even in its newer, friendlier sense. The praise is never for chaos in general. It is for chaos that used to be hinged, and is choosing not to be.