Why do all of the .dmg files I download end up on my desktop?
If you mean volumes that are shown after you mount dmg files, you can uncheck this checkbox:



You can eject volumes from Finder's sidebar or by selecting their icons and pressing ⌘E.