Where is the first use of a self animated doll, dummy or toy, in fiction or legend?
These are usually attributed to the ancient idea of a golem, from Jewish folklore.
In Jewish folklore, a golem (/ˈɡoʊləm/ goh-ləm; Hebrew: גולם) is an animated anthropomorphic being, created entirely from inanimate matter. The word was used to mean an amorphous, unformed material (usually out of stone and clay) in Psalms and medieval writing.
The most famous golem narrative involves Judah Loew ben Bezalel, the late-16th-century rabbi of Prague. There are many tales differing on how the Golem was brought to life and afterwards controlled.
What kid ever hasn't had a favorite teddy bear that was his best friend and most certainly alive in its own right?
Ancient Greek mythology had various examples, Pygmalion being a sculpture, Talos was a man of bronze, Hephaestus made automatons for Zeus, etc...
Japanese folklore in the 10th century have tsukumogami, which are things like tools that have been used so long that they have come to life on their hundredth birthday.
From the same source as the Polish golem in the 16th century, homunculus.
In the 20th century we have Mickey Mouse animating brooms to do his cleaning =P
Further back there are creation myths where god just makes dolls and breathes life into them.