If you want to get to the bottom of it then you must pay attention to the **individual meanings of characters** and **the story of their union**.

客氣(客气) is made of **客** (**guest** + untranslatable part of the meaning) and **氣** (**spirits** + untranslatable part of the meaning). In pretty much all eastern cultures a guest is usually a stranger with whom you haven't developed a close relationship yet therefore a guest is someone you know but still not necessarily accept as your friend. The reason why this situation is associated with politeness is because being able to make progress from **guest status** to **friend status** has been way more crucial for survival and one's well-being in "*The East*" than it is in "*The West*" therefore people would be willing to force themselves to temporarily alter their behavior and serve some extra kindness and niceness in order to remove the social distance and get accepted as soon as possible as their personal welfare would be constantly at stake otherwise.

礼貌 is made of 礼 (sincere respect offered by a candid person) and 貌 (appearance / form / stature / pose / how something looks / shape). Therefore the kindness and niceness observed in the behavior of such a person could possibly be more like a natural thing that happens due to the *personality-by-birth* rather than something produced and served like an actors thing.

Note that in today's world, many native speakers never mind or even never realize these details and use both of them interchangeably.