A Gravity dam is a structure which is designed in such a way that its own weight resist the external forces acting on it like Water pressure, pressure due to uplift , waves and silt.
If you look at the hydrostatic pressure distribution in a gravity dam, the bottom part of the dam has the maximum hydrostatic water pressure.
This pressure eventually drops while we go to height.
In order to resist more forces, the base is going to be big.
So, the elementary profile of the dam is going to be a right angle based on hydrostatic pressure distribution.