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, ...