When someone puts garlic over the door the garlic over the door means to keep out envious people.
Having garlic over the door is supposed to also bring good luck and protect the home from evil.
Some people believe that hanging garlic over the door helps to guard against the intrusion of evil, to keep out robbers and thieves etc.
It's just a superstition and just because you do hang garlic over your door does not mean there won't be evil in the house or you won't be robbed.
But some people are superstitious and have those beliefs and that is okay.
Putting garlic over your door does really nothing but can help keep mosquitoes away as well.