An atom interacting with a quantized electromagnetic field in a cavity with time-dependent parameters is considered. Variation of the cavity parameters results in excitation of the atom, even if photons were initially absent in the cavity. We study a new mechanism of atom excitation and photon creation inside the cavity which we call the dynamical Lamb effect, and which has no relation to the dynamical Casimier effect. Several aspects of this mechanism are studied, including physical interpretation, amplification of the amplitude in the case of long-time periodic variation of the cavity parameters, and possible physical realization. Although the consideration is based mainly on a simple model of an atom interacting with a single mode of quantized electromagnetic field, and the results are qualitatively valid for more realistic models.