@Michael_Callen, to give you the most important distinction, this is wroth considering.
Perhaps one of the most important distinctions between a flagellum and a rotary engine is that a rotary engine is far more complex than a flagellum, with far more different types of parts. The flagellum is far more like a mousetrap (with just 3 different parts) than any human designed rotary motor.
There are about 22 different proteins in the flagellum. Interestingly enough, most these proteins are very similar to one another. It is as if there are, maybe, 4 different parts, each with 5 variations, that are put together to make a flagellum, which looks superficially like a human rotary engine, but is actually working by totally different physical principles. The early flagellum might have had just 4 types of parts or even fewer. That is why it is far more similar in complexity to a simple mousetrap than a complex rotary engine.
Of course, by calling it a “motor” that is not the image in your head. You imagine something profoundly complex when the flagellum is not nearly as complex by any objective measure as a motor.