To be clear, energy is conserved on local scales, most definitely. However, on very large scales, the universe is undergoing accelerated expansion (and time invariance does not hold), and a valid way to think of this is to allow that the energy of the universe changes with time. Here is a discussion: https://www.preposterousuniverse.com/blog/2010/02/22/energy-is-not-conserved/. (This is getting well beyond the scope of this course, though.)