The theory is that vampirism can be seen as symbolic of mosquito bites - and garlic is known in folklore as a natural mosquito repellent.
There is a long history of using garlic to get rid of many insects, from slug to mosquito. In particular garlic has a reputation for protecting people from mosquito bites - some think that this could be the origin of the belief that vampires are scared of garlic. There are a number of commercial garlic sprays on the market, these effectively coat an area and produce a natural mosquito barier.
http://www.garlic-central.com/mosquito.html
Mosquitoes suck blood and in doing so spread disease. So do vampires. Some of the symptoms of malaria - exhaustion, fever, anemia - are reminiscent of the reputed effects of being bitten by a vampire without being totally drained or turned. Garlic is a known insect repellent which reportedly works well against mosquitoes. This would fit well with the vampire folklore and gothic fiction.