I read on a book that the system of two or more independent harmonic oscillators in classical mechanics is not ergodic. I want to know why a harmonic oscillator is actually ergodic but two or more ones is not. Is it related to this fact that the phase space of two independent harmonic oscillators is the product $M \times M$ and each one's ergodicity does not force the whole ergodicity?
The orbits of the harmonic oscillator in 1D are closed curves in the phase space - and the key here is that these curves coincide with the (1D) energy surfaces $S$ of the system, which means that the energy surface is trivially fully explored by a trajectory (so the system may be ergodic).
In more dimensions, i.e., for two or more independent harmonic oscillators, the conserved quantities are the energies of the individual normal modes, defining a surface that doesn't coincide with $S$, which is the surface of total constant energy of the system. In other words, the system's conserved quantities are not constant in $S$, which therefore cannot be fully explored, which means the system cannot be ergodic.
Also relevant is the question Are there necessary and sufficient conditions for ergodicity?.
It looks like the definition in that book allows at most one conserved quantity in their definition of ergodic. This is not standard. But in this case 1 harmonic oscillator has 1 conserved quantity while n have n conserved quantities. That is the energy of each oscillator. In any case, look at the manifold filled out by the trajectory. You will see some Liouville tori or not depending on number of conserved quantities.