c. 1300, "mechanical device," especially one used in war; "manner of construction," also "skill, craft, innate ability; deceitfulness, trickery," from Old French engin "skill, wit, cleverness," also "trick, deceit, stratagem; war machine" (12c.), from Latin ingenium "innate qualities, ability; inborn character," in Late Latin "a war engine, battering ram" (Tertullian, Isidore of Seville); literally "that which is inborn," from in- "in" (from PIE root *en "in") + gignere, from PIE *gen(e)-yo-, suffixed form of root *gene- "give birth, beget."
Sense of "device that converts energy to mechanical power" is 18c.; in 19c. especially of steam engines. Middle English also had ingeny (n.) "gadget, apparatus, device," directly from Latin ingenium.