A natural atom placed into a cavity with time-dependent parameters can be parametrically excited due to interaction with the quantized photon mode. One of the channels for this process is the dynamical Lamb effect, induced by a nonadiabatic modulation of the atomic-level Lamb shift. However, in experiments with natural atoms it is quite difficult to isolate this effect from other mechanisms of atom excitation. We point out that a transmission line cavity coupled with a superconducting qubit (an artificial macroscopic atom) provides a unique platform for observation of the dynamical Lamb effect. A key idea is to exploit a dynamically tunable qubit-resonator coupling, which was implemented quite recently. By varying the coupling nonadiabatically, it is possible to parametrically excite a qubit through a nonadiabatic modulation of the Lamb shift, even if the cavity was initially empty. The dynamics of such a coupled system is studied within the Rabi model with a time-dependent coupling constant and beyond the rotating-wave approximation. An efficient method to increase the effect through the periodic and nonadiabatic switching of the qubit-resonator coupling energy is proposed.