1823, in Suffolk dialect, "a cart," especially one with wheels flanged for running on a track (1858), probably from troll (v.) in the sense of "to roll." Sense transferred to "pulley to convey current to a streetcar motor" (1890), then "streetcar drawing power by a trolley" (1891).
Crazy; demented; nuts: You're off your trolley
[1896+; fr the helpless condition of a streetcar of which the trolley, a spring-loaded shaft with a wheel at the top to engage the electric wires, has come off the wires]
A stupid person; a dullard
[1970s+ Army; probably fr the dwarf or demon of Norse mythology]