AVI is a container format - i.e. it contains video and audio streams. H.264 is one of many video formats that AVI can contain.
Here's a Wikipedia article on the various container formats and their capabilities:
i want to convert my AVCHD files to either H.264 or AVI? which one is better when it comes to video quality?