in the figurative sense "wildly irresponsible person, potent person or thing freed from usual restraint," by 1896; in the literal sense an object of dread on old warships; the figurative use probably arose from a celebrated scene in a popular late novel by Victor Hugo:
You can reason with a bull dog, astonish a bull, fascinate a boa, frighten a tiger, soften a lion; no resource with such a monster as a loose cannon. You cannot kill it, it is dead; and at the same time it lives. It lives with a sinister life which comes from the infinite. It is moved by the ship, which is moved by the sea, which is moved by the wind. This exterminator is a plaything. [Victor Hugo, "Ninety Three," 1874]
1885, in the criminal psychology sense, "a morally irresponsible person," considered as mentally deranged; "one who obeys his impulses regardless of social codes," a back-formation from psychopathic.
The Daily Telegraph had, the other day, a long article commenting on a Russian woman who had murdered a little girl. A Dr. Balinsky prevailed upon the jury to give a verdict of acquittal, because she was a "psychopath." The Daily Telegraph regards this term as a new coinage, but it has been long known amongst Spiritualists, yet in another sense. [The Medium and Daybreak, Jan. 16, 1885]
The case alluded to, and Balinsky's means of procuring the acquittal, were briefly notorious in England and brought the word into currency in the modern sense.
1560s, "idle vagrant, sturdy beggar, one of the vagabond class," a word of shadowy origin, perhaps a shortened form of roger (with a hard -g-), thieves' slang for a begging vagabond who pretends to be a poor scholar from Oxford or Cambridge, which is perhaps an agent noun in English from Latin rogare "to ask." Another theory [Klein] traces it to Celtic (compare Breton rog "haughty"); OED says, "There is no evidence of connexion with F. rogue 'arrogant' " (the theory supported in Century Dictionary).
By 1570s, generally, as "dishonest, unprincipled person, rascal." In slight playful or affectionate use, "one who is mischievous," 1590s. Meaning "large wild beast living apart from the herd" is by 1859, originally of elephants. As an adjective, in reference to something uncontrolled, irresponsible, or undisciplined, by 1964. Also common in 17c. as a verb. Rogue's gallery "police collection of mug shots of notorious law-breakers" is attested from 1859.
c. 1600, "group of students," in U.S. especially "number of pupils in a school or college of the same grade," from French classe (14c.), from Latin classis "a class, a division; army, fleet," especially "any one of the six orders into which Servius Tullius divided the Roman people for the purpose of taxation;" traditionally originally "the people of Rome under arms" (a sense attested in English from 1650s), and thus akin to calare "to call (to arms)," from PIE root *kele- (2) "to shout." In early use in English also in Latin form classis.
Meaning "an order or rank of persons, a number of persons having certain characteristics in common" is from 1660s. School and university sense of "course, lecture" (1650s) is from the notion of a form or lecture reserved to scholars who had attained a certain level. Natural history sense "group of related plants or animals" is from 1753. Meaning "high quality" is from 1874. Meaning "a division of society according to status" (with upper, lower, etc.) is from 1763. Class-consciousness (1903) is from German Klassenbewusst.
The fault, the evil, in a class society is when privilege exists without responsibility and duty. The evil of the classless society is that it tends to equalize the responsibility, to atomize it into responsibility of the whole population—and therefore everyone becomes equally irresponsible. [T.S. Eliot, BBC interview with Leslie Paul, 1958]