@maninanikittycat's post on Artfol

How would a robot be possible in a fantasy setting?Dec 2, 2022
Comments
???? Magic
From my experience with Final Fantasy 9 and Tales of Arise, introduce another planet with a more advanced civilization
It depends on the laws of the universe. I would argue Golems are folklore examples of such a thing, but they come from Jewish folklore and they are (understandably!) not too happy with non-jews using golems!
But to make your own, you need to understand what computers are. They are rocks and metals we have put together in order to understand math by using electricity. Everything a computer understands is a series of "on" and "off"s. 1s and 0s. With magic, it's actually easy to remove electricity and modern technology from the equation. Magic becomes the power source.
Robots use complex code in order to think for themselves. Code is just instructions given to a computer so it knows what to do in certain circumstances. I... Personally see magic as VERY similar. You give energy the instructions on what to do, and generally follow set instructions to achieve specific results.

So, essentially, a fantasy robot is a a man made construct that uses magic as both a power source and as it's "code".
You want to build a magic system that makes this possible, and have magic be advanced enough for someone to be able to piece such technology together.

But you can also do things like human souls implanted into artificial bodies
Cyberpunk-esc robots with lots of gears and cogs. Or maybe, like, old giant wind up toys.