MP4 is a container format. It can store video or audio encoded in a variety of ways. So DivX is one codec.
Main reason is newer codecs are better. ie more efficient compression, so better quality video or smaller file sizes.
Nowadays probably the most common codec is H264, or the newer H265. H264 is used by Blu-ray, and by YouTube etc.
Also a question of licencing. DivX is a proprietary format. If you wanted to encode a video, you had to pay for the official software. And companies making DVD players etc would have to pay for a decoding licence etc.
There is also Xvid format, which is free/open source, kind of based on DivX. It was quite popular for while.
H264 is not free, parts of it are patented. But they have said it can be used free of charge for non-commercial software.