In past centuries "motor" and "engine" meant very different things. A motor was made to move something such as a vehicle. This meaning is still often used. Sometimes a thing is called an engine if it creates mechanical energy from heat, and a motor if it creates mechanical energy from other kinds of energy, like electricity. Typical "engines" in this meaning are steam engine and internal combustion engine, while typical "motors" are electric motor and hydraulic motor. And sometimes the two words mean the same thing.