What is the Mezuzah?

Why do we affix a Mezuzah in the entrance of our homes? Is is a good luck charm? Who originated this Jewish tradition?