1540s, "structure of any kind," from Middle French machine "device, contrivance," from Latin machina "machine, engine, military machine; device, trick; instrument" (source also of Spanish maquina, Italian macchina), from Greek makhana, Doric variant of Attic mēkhanē "device, tool, machine;" also "contrivance, cunning," traditionally (Watkins) from PIE *magh-ana- "that which enables," from root *magh- "to be able, have power." But Beekes, on formal grounds, objects to the connection to words in Germanic and Slavic. He finds the Greek word isolated and is convinced that it is Pre-Greek.
Main modern sense of "device made of moving parts for applying mechanical power" (1670s) probably grew out of mid-17c. senses of "apparatus, appliance" and "military siege-tower." It gradually came to be applied to an apparatus that works without the strength or skill of the workman.
From 17c.-19c. also "a vehicle; a stage- or mail-coach; a ship," and, from 1901, "a motor-car." Also in late 19c. slang the word was used for both "penis" and "vagina," one of the few so honored.
The political sense "a strict organization of the working members of a political party to secure a predominating influence for themselves and their associates" is U.S. slang, attested by 1876. Machine age, a time notable for the extensive use of mechanical devices, is attested by 1882, though there is this:
The idea of remodelling society at public meetings is one of the least reasonable which ever entered the mind of an agitator: and the notion that the relations of the sexes can be re-arranged and finally disposed of by preamble and resolution, is one of the latest, as it should have been the last, vagary of a machine age. ["The Literary World," Nov. 1, 1851]
Machine for living(in) "house" translates Le Corbusier's machine à habiter (1923).