Recent nanofabrication technologies have miniaturized optical and mechanical resonators, and have led to a variety of novel optomechanical systems in which optical and mechanical modes are strongly coupled. Here we hybridize an optomechanical resonator with two-level emitters and successfully demonstrate all-optical dynamic control of optical transition in the two-level system by the mechanical oscillation via the cavity quantum-electrodynamics (CQED) effect. Employing copper-doped silicon nanobeam optomechanical resonators, we have observed that the spontaneous emission rate of excitons bound to copper atoms is dynamically modulated by the optically-driven mechanical oscillation within the time scale much shorter than the emission lifetime. The result is explained very well with an analytical model including the dynamic modulation of the Purcell effect and the exciton population. To the best of our knowledge, this is the first demonstration of a dynamic modulation of the spontaneous emission rate by mechanical oscillations. Our achievement will open up a novel field of hybrid optomechanical CQED systems in which three body--optical transitions, optical resonance modes, and mechanical resonance modes--are strongly coupled and will pave the way for novel hybrid quantum systems.