The present work studies the nonlinear dynamics of a shear layer, driven by a body force and confined between parallel walls, a simplified setting to study transitional and turbulent shear layers. It was introduced by Nogueira & Cavalieri (J. Fluid Mech., vol. 907, 2021, A32), and is here studied using a reduced-order model based on a Galerkin projection of the Navier–Stokes system. By considering a confined shear layer with free-slip boundary conditions on the walls, periodic boundary conditions in streamwise and spanwise directions may be used, simplifying the system and enabling the use of methods of dynamical systems theory. A basis of eight modes is used in the Galerkin projection, representing the mean flow, Kelvin–Helmholtz vortices, rolls, streaks and oblique waves, structures observed in the cited work, and also present in shear layers and jets. A dynamical system is obtained, and its transition to chaos is studied. Increasing Reynolds number $Re$ leads to pitchfork and Hopf bifurcations, and the latter leads to a limit cycle with amplitude modulation of vortices, as in the direct numerical simulations by Nogueira & Cavalieri. Further increase of $Re$ leads to the appearance of a chaotic saddle, followed by the emergence of quasi-periodic and chaotic attractors. The chaotic attractors suffer a merging crisis for higher $Re$, leading to a chaotic dynamics with amplitude modulation and phase jumps of vortices. This is reminiscent of observations of coherent structures in turbulent jets, suggesting that the model represents a dynamics consistent with features of shear layers and jets.