The wizard's magic system in D&D came from the ideas of Jack Vance and some of his stories from over fifty years ago. The way you describe it is related to the older versions of D&D. Our colleague here, @aramis, found a good explanation for this:
Pre-4E D&D's magic system, ignoring sorcerers, is best explained by a
visualization of spells as "knots" of mana.
For wizards, these knots are made using the spellbook page as a form;
the spell literally can't be shaped without its assistance. The shape
of the knot determines its function. Further, a wizard can only hold a
few at first, but as they improve in ability, they learn how to tie
more of them to themselves, as well as channeling more mana daily. At
"Casting," what's being done isn't actually casting, but triggering
the mana-knot to unfold so as to have the effect.
This is based upon Bill Willingham's explanation of magic in the Ironwood graphic novels.
In 5e DnD, the model based on a Vancian magic system has been modified in that the wizard still prepares spells from a spellbook, but could cast one of the prepared spells multiple times based on whether or not enough spell slots of the correct level remain. That wasn't the case in, for example, AD&D 1e where the wizard loaded the clip (so to speak) in his mind. As each spell was expended it was unavailable until another preparation session (reloaded). Gary Gygax credited the Dying Earth series for strongly influencing his ideas on magic users.
A good explanation of this can be found at this answer here on RPG.SE.
Vance's Wizards are Limited to Concurrent Spells, not Spells Per Day
This is a matter of "gameplay" vs. "realism." Vance's wizards have a limit on the number of spells available at one time, without easy access to replenish their spells. D&D wizards are limited to the more "gamey" spells per day, with ready access to their spell books.
Insofar as "in fiction" justification, in Vance's world magic was rare, powerful and dangerous. Within the stories this added to the tension and sense of danger.
In fiction in 5e, the basic principle keeps the wizard bound to his spell books (a residual Vancian concept/fiction), but how the wizard used the magic available in the Weave (the in-fiction source of magic) is arbitrarily chosen as different from how the other spell casting classes tap into the Weave. They are all still limited by spell slots.