Photoswitchable molecules are employed for many applications, from the development of active materials to the design of stimuli-responsive molecular systems and light-powered molecular machines. To fully exploit their potential, we must learn ways to control the mechanism and kinetics of their photoinduced isomerization. One possible strategy involves confinement of photoresponsive switches such as azobenzenes or spiropyrans within crowded molecular environments, which may allow control over their light-induced conversion. However, the molecular factors that influence and control the switching process under realistic conditions and within dynamic molecular regimes often remain difficult to ascertain. As a case study, here we have employed molecular models to probe the isomerization of azobenzene guests within a Pd(II)-based coordination cage host in water. Atomistic molecular dynamics and metadynamics simulations allow us to characterize the flexibility of the cage in the solvent, the (rare) guest encapsulation and release events, and the relative probability/kinetics of light-induced isomerization of azobenzene analogues in these host–guest systems. In this way, we can reconstruct the mechanism of azobenzene switching inside the cage cavity and explore key molecular factors that may control this event. We obtain a molecular-level insight on the effects of crowding and host–guest interactions on azobenzene isomerization. The detailed picture elucidated by this study may enable the rational design of photoswitchable systems whose reactivity can be controlled via host–guest interactions.