Why do people wear black hats if their kippa has 2 layers?
See pg. 127 ff. of this publication from YCT. It is an article by Jason Weiner titled "ON THE HALAKHIC BASIS FOR WEARING BLACK HATS". In this article he discusses 5 reasons given by the Rabbinical Authorities for wearing a black hat:
- Kavod (Respect)
- Distingishing ourselves from the other nations
- Atifah (Wrap)
- Double Covering
- A Jewish custom has the strength of Halacha
The Chayei Adam says for birkas hamazon, "and wear a hat, like any respectable person would do if they were walking in the street."
R' Yitzchak Hutner once told a fellow: "wear a hat. A yarmulka is too easy to fold up and put in your pocket if you get embarrassed of being Jewish." (Very similar to the Lubavitcher Rebbe's letter about sheitels vs. kerchiefs.)
The Zohar is meramez that a talmid chacham needs an extra level of head covering, especially upon saying a davar shebik'dusha. Regarding the hat, it not only is a second cover, but it is bigger and more demonstrative of one's devotion.
The Zohar adds, for instance, that one should wrap oneself with a tallis during davening; apparently, standing with a kippah is not enough. The same wrapping concept would apply to a hat that hovers above the head very much like a tallis, albeit slightly less.
All of these head coverings indicate deference to someone greater, and that we commit to G-D's commands even when we cannot understand and even if our ideas conflict with it; we still accept.
The main reason people wore hats during davening was because that's what they would wear when in front of someone important. Nowadays, they mainly wear it so as not to change from before, or to differentiate themselves from other people. The two-layer thing is not in the Shulchan Aruch, but if one does want to follow it, I could see why one item wouldn't make the cut.
There is more than one reason to wear a hat while praying.
The idea of the double covering.
Having two layers bidieved fulfills this. A separate hat is considered better than just the two layers of the kipa. The main reason for two layers in a kipa is in case one might not have their hat with them at all times and at some point will want to make a bracha on food.
The idea of getting dressed up in a more respectful manner to speak with Hashem.
Likewise if one would wear nice clothing to see someone important there is a kal vachomer to prayer.
This is a good class which speaks about this at length...