We analyze the displacements of the particles of a glass-forming molecular liquid perpendicular to a confining solid surface using extensive molecular dynamics simulations with atomistic models. In the vicinity of an attractive surface, the liquid molecules are trapped. Transient localization of liquid molecules near the surface introduces a relaxation process related to the escape of molecules from the surface into the dynamics of the interfacial liquid layer. To describe this process, we analyze several dynamical observables of the confined liquid. The self-intermediate scattering function and the mean-squared displacement of the particles located in the interfacial layer are dominated by the process of escaping from the surface. This relaxation process is also associated with a strong heterogeneity in the mobility of the interfacial particles. The studied model liquid is hydrogenated methyl methacrylate. For the confining wall, we consider different models, namely a periodic single layer of graphene and a frozen amorphous configuration of the bulk liquid (frozen wall). Near graphene, where the liquid molecules form a layered structure and adopt parallel-to-surface orientation, a clear separation between small-scale movements of the molecules near the surface and the process of escaping from the surface is observed. This is reflected in the three-step relaxation of the interfacial layer. However, near the frozen wall, where the liquid molecules do not have a preferential alignment, a clear three-step relaxation is not seen, even though the dynamical quantities are controlled by the process of escaping from the surface.