Etymology refers to the study of the origins of words and language. Below are etymological definitions of the two words. Both of them go waaaaay back to long before electricity was discovered or the internal combustion engine invented.
HTH
B.
Motor
1447, from Latin motor, literally "mover," from movere "to move". From 15th century as "controller, prime mover" (in reference to God); sense of "agent or force that produces mechanical motion" is first recorded 1664; that of "machine that supplies motive power" is from 1856. With explosive use 20c. as a combined form of motor-car. First record of motor-cycle attested 1896; motor-boat is from 1902. Motor-car is from 1895; motorist is from 1896. Motorcade from 1913. First record of slang motor-mouth "fast-talking person" is from 1971.
Engine
Circa 1300, from Old French engin "skill, cleverness," also "war machine," from Latin ingenium "inborn qualities, talent," from in- "in" + gen-, root of gignere "to beget, produce." At first meaning a trick or device, or any machine (especially military); sense of one that converts energy to mechanical power is 18th century, especially of steam engines. Engineer "locomotive driver" is first attested 1839, American Engineer.