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.