The myth of the golem, first popularized around the 10th century comes out of Jewish mysticism, an ancient theosophy that dates back to the first century AD. 

The myth goes something like this:

Rabbi Yehudah Levi ben Betzalel (also called Rabbi Loew) of the 16th century city of Prague, created the most famous golem, as a servant and guard for the poor and oppressed living in the Jewish sector.   The golem was formed of river clay on a frame of tree limbs and rags, and animated with holy words shouted by the Rabbi (other versions have it animated by the placing of the name of God in writing on its arm or forehead, or in its mouth). 

The golem understood human language and would obey verbal commands, but itself was mute.  In order that the golem be able to do its work independently, each day the Rabbi wrote instructions on a piece of paper, which he then put in the golem's mouth.  The power of this written word is what caused the golem to be active in the absence of verbal commands.   The golem accumulated enough experience and knowledge as to develop a human personality.  His physical power and status as guard of the community went to his head, and he became a menace to the public safety he was supposed to be protecting.  The Rabbi eventually had to unmake his creation in order to prevent disaster.  Today a statue of this golem stands at the entrance to the Jewish sector of Prague. 
 
As in most myths, however, the details of the golem story vary from source to source. 
Another source tells that the golem was created to defend the Jews of Prague from the blood libel, which is 
the belief that Jews used the blood of a Christian child during the Passover Seder. This malicious libel was frequently invoked to explain the disappearance of a child, and it was not uncommon for a dead or murdered Christian child to be planted in a Jewish house, often by a priest who would then "discover" this child and lead the masses on a murderous rampage through the ghetto, during which much Jewish property could be confiscated for the church.
-jewishgothic.com
The golem myth is also connected to an older myths which tell that the name of God, put on a dead person's  arm or in his or her mouth, will reanimate the person.  Removing the name would cause the person to return to death. 

Sources/Links
A children's version of the Golem myth, with a nontraditional ending.
A Rutgers professor's scholarly look at the myth
A look at Jewish Gothic stories
Encyclopedia.com's definition of a golem
 

The Golem of Prague
thanks to jewishgothic.com