The answer belies the common misconception that getting to and from space is merely a matter of going up and down through the atmosphere. At this phase of re-entry, the velocity of the spacecraft is mostly in the direction across the atmosphere, not down through the atmosphere. You can see that the hottest points on both spacecraft are actually along the leading edges, not the bottom.
We've visited the topic of orbital speed before (as has XKCD). Although you have to get "high enough" to get into space, you also need to get "fast enough" to stay there. In particular, there must be a significant component of the velocity tangential to the orbit (that is, in the direction around the Earth). The Shuttle did this by pitching over quite early in its ascent, reaching an orbital velocity in the range of 7.5 to 8.0 km/s.
Returning from orbit requires the spacecraft to lose this velocity, which is done by atmospheric drag. The hottest part of the spacecraft will be at the edges facing the direction of the velocity (bow shock). Because the velocity is still mostly in the tangential direction, it is the edges along the side facing the orbital velocity. As you can see in the Shuttle painting, these leading edges are the nose and the forward edges of the wings and vertical stabilizer. The hottest parts of the Shuttle were covered in black tiles, and you can see them in the picture below covering the nose, wing edges, and tail edges (even in places that are on the "top side"!).
Re-entry for Apollo was somewhat more complicated, as it was a trans-Earth injection rather than a low Earth orbit. The re-entry speed was 11 km/s. However, the direction of this velocity was still mostly across the atmosphere, rather than down through the atmosphere (see "relative wind" in the diagram below). Again, the hottest part of the spacecraft will be the side facing the direction of travel (the right side in the painting above). Indeed, the heat shields of Apollo capsules were not uniformly constructed, but instead were thickest on one edge of the base of the spacecraft. From Apollo Experience Report: Thermal Protection System (Tech Note D-7564):
Why did the Apollo and Shuttle descend pitched at an angle, rather than purely horizontal or vertical? Well, that's the subject of another question...