AVI is a container, and an old one at that
AVI dates back to the early 1990s, predating essentially every modern video codec — it's a container format that can technically hold many different types of video and audio streams inside it, which is exactly why AVI files are inconsistent in practice: two AVI files can use completely different internal codecs and behave very differently despite sharing the same file extension. This inconsistency is a major source of AVI files that “should” play but don't, because the specific codec combination inside isn't one your device or software happens to support.
MP4 is both newer and more consistently implemented across devices, which is why converting resolves compatibility problems that are fundamentally about AVI's aging, variable internals rather than anything wrong with the specific file.
Where AVI files still show up today
Old home videos, footage from older digital cameras and camcorders, archived recordings from software that hasn't been updated in years, and content downloaded from sources that never modernized their format all commonly still exist as AVI. If you've inherited a folder of old family videos or dug up archived recordings from years ago, there's a reasonable chance some are in this aging format.
AVI also frequently uses older, less efficient codecs internally even when it does play correctly, which means the files tend to be considerably larger than a modern MP4 of equivalent visual quality — converting often shrinks the file substantially as a side benefit of modernizing the codec.
What to expect quality-wise from the conversion
Converting from AVI's older codecs to MP4's modern H.264 is a genuine re-encode, and depending on the AVI file's original codec and quality, the result can actually end up looking as good or better at a smaller file size, since modern codecs are simply more efficient at preserving visual quality per unit of data. This is one of the more favorable format conversions in terms of the size-for-quality trade-off, precisely because the source format is old enough that modern encoding has had decades to improve.
A quick note on very old or unusual AVI files
Some very old or unusually-encoded AVI files use obscure codecs that modern software has limited or no support for reading at all, which can cause a conversion attempt to fail or produce corrupted output — this is rare but worth knowing about if you encounter an AVI file that seems to resist every conversion attempt. In that specific situation, the file's internal codec itself may need to be identified before a working conversion path can be found.