Our current understanding of the chemistry and mass-loss processes in solar-like stars at the end of their evolution depends critically on the description of convection, pulsations and shocks in the extended stellar atmosphere. Three-dimensional hydrodynamical stellar atmosphere models provide observational predictions, but so far the resolution to constrain the complex temperature and velocity structures seen in the models has been lacking. Here we present submillimeter continuum and line observations that resolve the atmosphere of the asymptotic giant branch star W Hya. We show that hot gas with chromospheric characteristics exists around the star. Its filling factor is shown to be small. The existence of such gas requires shocks with a cooling time larger than commonly assumed. A shocked hot layer will be an important ingredient in the models of stellar convection, pulsation and chemistry that underlie our current understanding of the late stages of stellar evolution.