Character levels are an abstraction of continuous growth
The characters themselves know that they are getting stronger, but they don't experience discrete jumps in power within the game. Instead, they steadily get stronger as they get more experience. The players and the DM use levels to represent that advancement in a useful way.
To use your wizard example, the PHB (pg. 114) states:
The spells that you add to your spellbook as you gain levels reflect the arcane research you conduct on your own, as well as intellectual breakthroughs you have had about the nature of the multiverse. You might find other spells during your adventures. You could discover a spell recorded on a scroll in an evil wizard's chest, for example, or in a dusty tome in an ancient library.
This means that in-universe, wizards are constantly gaining insights and conducting research, and thus continually developing and finding new spells as they adventure. The (in-universe) wizard knows that they have new spells when she researches or finds a new one, regardless of level.
However, it's difficult to represent this continuous, somewhat random improvement in a tabletop RPG, which is why the (5e) rules have discrete levels. Just as the initiative order is an orderly abstraction of a chaotic battle where everyone's trying to act at the same time, so too is the leveling system an abstraction of steady progress.