<p>the same way as when you say youre sorry when you burp, shake hands when introduced to another person, dont put feet on table, you dont wear a hat in a building. Its part of good manners that separate people with good manners from people with bad ones. However, as all manners, the custom has an origin in necessity. In medieval times knights upon entering a manor lifted their visors to show their faces. Later the tradition continued with military salutes, and men tipping their hats to another to acknowledge each other in a greeting. As a sidenote, even now if a male of a noble line (Duke or King) visits someone at their home, even the host will have their top hat present, since it indicates that the more nobler personage should consider the hosts home his own and the host a guest in his own home.</p>