Greek μηχανή — mēkhanē: instrument, device, contrivance, means.
Latin machina: machine, engine, apparatus, contrivance.
Middle French machine → English machine.
The semantic field is older and broader than today's image of gears, motors and electronics.
English word machine comes through Middle French from Latin machina, which in turn derives from the Greek (Doric μαχανά makhana, Ionic μηχανή mekhane "contrivance, device, ...
In Greek theatre, a mēkhanē could be the stage apparatus that lifted a god into view.
Hence: deus ex machina — the god from the machine.
human construction → superhuman appearance
The machine makes visible powers that exceed the ordinary human body.
The machine begins not only with matter, but with know-how.
Greek technē means skilled, rule-governed making.
thought → technē → artifact
Before artificial agency comes the intelligence of the maker.