Whenever there is a large reservoir of water, as in case of dams, obviously the weight of all the water molecules of the upper layers of water will fall on the bottom layer. Thus the bottom layer of water in the reservoir experiences the highest pressure. So if the dam has uniform width and if its gates are opened, then the gates near the surface will shoot out water more farther as compared to the gates above it. This will result in instability of the dam and might break it. So the bottom of the dam is made broader at bottom which can withstand the pressure from water.
The same principle applies to buildings, just the weight directly falls on the base.