Some avi's play perfectly through QuickTime while others don't. When they don't it is usually because they have been encoded as divx avis. Some people say you're best to use VLC for these, others say Mplayer. Personally, I don't like either, I tend to avoid avis if I can. Alternately, this is my preferred option, you can download a codec from www.divx.com. You can also rebuild some avi files with a program called "DivX Tool OSX" if you really have to play them in QuickTime.
.avi is just a cover term for loads of different formats. They range from divx to 3ivx to Windoze mp4 'variants' or even regular mp4, if you want. The divx and 3ivx formats are actually quite good and, if done correctly, offer much higher quality:size ratios than .mpeg files (which are the worst). Also, audio can be encoded differently: MP3, AAC etc. Quicktime can only do some of these codecs/ handles some badly.
For playing .avis use one of these apps: http://www.macupdate.com/info.php/id/5758 (VLC) or http://www.macupdate.com/info.php/id/10784 (MPLayer). Both players are free and play 99% of the stuff out there. QT is only really good for streaming and... .mov files.