In a uniformly rotating fluid, inertial waves propagate along rays that are inclined to the rotation axis by an angle that depends on the wave frequency. In closed domains, multiple reflections from the boundaries may cause inertial waves to focus onto particular structures known as wave attractors. These attractors are likely to appear in fluid containers with at least one boundary that is neither parallel nor normal to the rotation axis. A closely related process also applies to internal gravity waves in a stably stratified fluid. Such structures have previously been studied from a theoretical point of view, in laboratory experiments, in linear numerical calculations and in some recent numerical simulations. In the present paper, two-dimensional direct numerical simulations of an inertial wave attractor are presented. By varying the amplitude at which the system is forced periodically, we are able to describe the transition between the linear and nonlinear regimes as well as the characteristic properties of the two situations. In the linear regime, we first recover the results of the linear calculations and asymptotic theory of Ogilvie (J. Fluid Mech., vol. 543, 2005, pp. 19–44) who considered a prototypical problem involving the focusing of linear internal waves into a narrow beam centred on a wave attractor in a steady state. The velocity profile of the beam and its scalings with the Ekman number, as well as the asymptotic value of the dissipation rate, are found to be in agreement with the linear theory. We also find that, as the beam builds up around the wave attractor, the power input by the applied force reaches its limiting value more rapidly than the dissipation rate, which saturates only when the beam has reached its final thickness. In the nonlinear regime, the beam is strongly affected and becomes unstable to a subharmonic instability. This instability transfers energy to secondary waves possessing shorter wavelengths and lower frequencies. The onset of the instability of a narrow inertial wave beam is investigated by means of a separate linear analysis and the results, such as the onset of the instability, are found to be consistent with the global simulations of the wave attractor. The excitation of such secondary waves described theoretically in this work has also been seen in recent laboratory experiments on internal gravity waves.