Does the iPhone 5 play AVI videos?
Yes. In its supported TV and Video file types Apple make is clear that the iPhone 5 supports “Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format.”
“Some of my AVI files can’t be synced to iPhone 5…”
.AVI (Audio-video Interleave) is a container format introduced by Microsoft. While there are multiple differing codecs that can be used within an AVI file, Motion JPEG is a type of .AVI compression. According to Apple's iPad tech specs, the iPhone 5 does support M-JPEG .AVI files, but there's no indication that the specific XviD codec (encoding/decoding) is supported. In fact neither Apple iTunes nor the stock player on iPhone 5 supports DivX/ Xvid encoded .AVI videos.
How do I sync AVI footage/videos to iPhone 5?
The majority of digital cameras (e.g. Panasonic Lumix cams) still use Motion JPEG to capture video, and the generated footage is naturally supported by iPhone and iPad. To sync AVI on a camera to iPhone 5, you can either import AVI shootings directly from camera when the iPhone 5 is connected with the camera using an iPad Camera Connection Kit; or transfer the AVI footage to computer via USB connection, and then add the AVI to iTunes library, from where you can sync the AVI videos to iPhone just like you do with iTunes movie purchases. See how to sync iTunes videos to iPhone 5.
AVI videos compressed with Xvid/DivX are not accepted by iTunes. To sync Xvid .AVI files to iPhone 5, you can convert AVI to H.264 .mp4 format and then add the converted videos to iTunes. An iPad Video Converter can do the job for you. See how to convert AVI/MKV/TiVo/M2TS to iPhone 5 optimized MP4. Note that majority of DivX .AVI files are copy-protected and can not be converted.
How to play downloaded Xvid .AVI files on iPhone 5?
If your have downloaded some .AVI videos from the internet but the stock player will not play them, my recommendation would be to install a third-party media player, like Playable or Video Downloader, the latter can also download online videos to your iPhone 5.