DaVinci made the Automa Cavaliere in the Middle Ages, and there were some pretty complex clockwork dolls in both france and japan during the 18th century. if you go further back, there were some clockwork animal novelties used to entretain sultans and chinese emperors The materials change with the era, (earliest ideas involved wood, leather and ropes, modern age mechanisms are full of tin, copper, rare metals and wires and after the industrail revolution everything is iron and steel), but the fascination with making mechanical animals and men exists for as long as people could make relatively small devices do many different motions.

but in the past a complex mechanism needed to be as big as a water wheel or windmill and depended on a natural source of movement or someone constantly manipulating it to work. The industrial revolution and steam powered engines allowed for the same machines to run independently for hours. That's what changed fascination to a fear they might be "too independent" one day