Why doesn't beryllium, an elemental solid, obey Dulong and Petit's law?
Not a  'Law' a such it is more like a 'rule of thumb' based on a limited set of data measure at high (i.e. room) temperatures. The heat capacity is not constant but varies with temperature and for metals reaches a limiting value of approximately $3R$ at high temperatures. (The limiting value is higher for molecules due to the many translational, vibrational and rotational energy levels).

The heat capacity is the rate of change of the energy with temperature, i.e. the slope  of a plot of energy vs temperature.  At low temperatures only the lowest few energy levels are populated, so the rate of change vs temperature is almost zero. As the temperature is increased, more energy is added, more levels become populated and $C_V$ rapidly increases because the rate of change of energy is large. At high temperature, very many levels are now populated and the rate of increase of energy with temperature is constant, and therefore $C_V$ levels off becoming almost constant.

In some metals, those with large energy gaps between levels, room temperature is insufficient for them to reach the point where the slope of internal energy increase with temperature becomes constant and so the heat capacity is smaller than $3R$. The value at higher temperatures (say 1000 C) should reach the limiting value.