Compression vs. Friction - what happens when space objects enter Earth's atmosphere?
Imagine a blunt object like a space-capsule entering the atmosphere. It experiences a decelerating force, right? If you divide this force by the surface area of the blunt front facing surface, we get an effective pressure. The atmosphere has to create this pressure in front of the object, otherwise there would be no force (a molecule streaming by the sides of the object without hitting it can't create such a force). This compression also heats the gas in front of the object.
The hot, dense gas now streams along the sides of the capsule. If we want to keep the capsule cool, then we certainly don't want this hot gas to touch the body again, which is why capsules are entering with the broad side and are not flying like planes with a sharp nose cone. The body angle has to be small enough that the gas can pass the entire body before it expands enough to reach the walls.
You can see these effects nicely in old NASA images showing the supersonic bow shock around models of their capsules, the dark areas are dense gas under high pressure, the light ones are less dense, low pressure regions:
The majority of the kinetic energy in the capsule will be converted to heating of gas in this bow shock, only a fraction of it will be absorbed by heat shield and an ever smaller amount will heat the backside walls. Without this phenomenon re-reentry would be an even harder thermal problem than it already is.