I realize the etymology of names are often confusing and debated over, so I guess the latter question may be the more informative one. I do know that the names don't come from the emperor's surname, nor are they necessarily some standalone word that has lexical meaning (eg. 隋 (Sui) doesn't mean anything other than the Sui Dynasty as far as I know).
It varies from one dynasty to another, but early rulers of China had a tendency to name the dynasties they found after the places they hailed from, or are strongly associated with them. E.g., in the case of Han, as stated in its Wikipedia page:https://en.wikipedia.org/wiki/Han_dynasty , the first emperor Liu Ban was once appointed as the prince of Hanzhong, in fact he was usually known as 'Lord of Han' before he became the Emperor. Sui is much similar, which is just the ancient name of the fiefdom of Yang Jian, Sui's founding emperor.
In the case of Yuan, it's a bit unique and quite famous, Kublai Khan, Yuan's first emperor, considered his dynasty to be unprecedented, so he took a quote, '大哉乾元', from I Ching, which means http://ctext.org/book-of-changes/qian 'Vast is the 'great and originating (power)' indicated by Qian(the first of the eight trigrams) !' The character 'Yuan(元)' literally means originating, first, premier,etc in Classical Chinese.
I could give some sources, but I don't have anything in English, so....
The dynasty is called the Sui (隋), but this is derived from Emperor Wen of Sui's title, which was the Prince of Sui (隨王). If you notice, the former lacks a "辶" radical, which means "running," because Emperor Wen thought that fortune would "run away" from his dynasty if he kept his title.
That brings up the point that many early dynasties (possibly all) are named after titles. These titles pretty much always refer to geographical places, and these titles might not be where the dynastic founder is from. The Liang Dynasty was always in the south, and though Emperor Wu of Liang was the Prince of Liang, he never hailed from Liang. I can think of only one dynasty where the emperor's surname and the dynasty name was the same: the Chen Dynasty, which was a short-lived state that existed only in the south of China.
Each dynasty's name was declared from the very beginning. Some dynasties were named after previous dynasties, hence the various Zhou or Han dynasties that have little or no relation to the famous Zhou or Han dynasties. Later dynasties like the Yuan, Ming, or Qing derive names from words that have positive meanings as opposed to geographical ones.