A DMG file (Apple Disk Image) is a disk image file that is mounted as a volume, just like a physical disk. They can be password protected and compressed (like ZIPs), and are usually used for packaging and downloading Mac software (amongst other things).
DMGs are exclusively an Apple file format (though can be opened as read-only on Windows computers with 3rd party software), while a ZIP file is universal, and can be opened on both Mac and Windows. The nice thing about them is the ability to mount them, as I mentioned earlier. When you open a ZIP, it extracts the files to your computer, taking up more space on your hard drive. A DMG once mounted, however, can be interacted with and ejected without copying any files or taking up space on your hard drive.
@klanomath said it best in their comment on this answer, so I will quote them here:
All valid DMGs contain a file system - so they are mounted exactly like a real partition to a file system. They get their own device/disk identifier (like all disks) Check diskutil list
after opening a DMG.
.dmg
is much more similar to a.iso
file than a.zip
file.