IMHO, The first name is the main name, the second is a nickname.
With Daniel, it's obvious.
With Haman, it seems that researchers believe that "Haman" is some kind of title or virtue's that is attached to the person.
Especially I remember scholar saying that Haman means "(owner of) good thoughts", which make the verse
וּבְבֹאָהּ֮ לִפְנֵ֣י הַמֶּלֶךְ֒ ...