I have Anti-Virus, why did I get infected ?

Most Anti-virus detection techniques involve a signature to identify a virus infected file. this means they are looking for a similar pattern in the file to identify

Malicious software makers don't want your anti-virus to detect the file, they encrypt the payload or obscure the file so that signature detection is impossible.

Most anti-virus can't detect a virus it does not know about, it is a cat and mouse game. There is a window between when a virus is detected 'in the wild' and the virus definitions are updated to block it. 

This window of opportunity is exploited often via email, read more.