Something similar to this: https://en.wikipedia.org/wiki/Oscillating_cylinder_steam_eng...
And you can still get them reasonably inexpensively: https://www.aliexpress.com/item/1005007964198565.html
I bought one for a friend's 5 year old a while back and became BEST UNCLE EVER!
The run well on compressed air (like an electric car tyre inflator or small air compressor), or for a bit more high temperature danger they run great attached to the steam wand of an espresso machine. When I was a kid dad built me a steam boiler out of a steal aerosol can and some copper tubing with a folded brass sheetmetal alcohol burner. That's not a 5 year old friendly thing though, from memory I'd have been maybe 10 or 12 when he started letting my light alcohol on fire in that garage or backyard. (Modern parenting may disapprove...)
Also considering the origins of precision - the intertwined evolution of machining tools and measuring systems that allowed these machines to be built.
RE: 3 year old - yes, mechanical systems are wonderful for children (and adults). There is something incredibly satisfying about watching them in motion doing work.
For a fun rabbit hole to dive down, check out Doble steam car technology or the Besler airplane engine.