DMG is a disk image file format.
In the 'old days' software was distributed on physical media (eg. CD-ROMs) which were read-only and ensured the software remained as intended by the software developer. Today, because of broadband internet, software is more easily downloaded, but software developers still need to ensure their software remains as they intended. Otherwise corruption (intended or otherwise) could occur during the file transfer.
Because DMG files are disk images they help reduce the risk of corruption by offering a way to package data in a fairly secure manner. These files behave like a physical disk. In so doing, the operating system interprets them in the same way as if you had just inserted a CD-ROM into the computer. That's why you need to eject them as you would a CD-ROM or external drive. The difference is that the DMG file itself remains on your computer, unlike a CD-ROM that is removed when ejected.
In addition to behaving like a physical disk, DMG files offer the benefits of verifying the integrity of their contents when they're opened. Not only does this offer the ability to compress any data contained within them, but also provides read-only options so they can serve only one purpose - the purpose of distributing software.
So, in a nutshell, DMG is a disk image format while ZIP is an archive format. They may seem to both do the same thing, but in reality they don't.