Yes, as soon as the wizard levels up, those two spells are found in one of his spellbooks and he can prepare them the next time he prepares his spells. They do not require time or money to scribe, though they do fill up the appropriate number of pages in his spellbook.
This is one of those things that’s supposedly been going on in the background the entire time since the last level—the fighter’s been practicing new moves, the cleric’s been praying, the monk’s been meditating, and the wizard’s been studying. We have a lot of questions about these kinds of things, and they all have the same answer: while mechanically we just have the entire class level just pop into existence at some point, narratively this is more of a “eureka!” moment when it all comes together.
So the wizard’s two spells do “just appear” in a mechanical sense, in that this is one of their class levels, but behind the scenes/off screen the wizard has been working on getting them right the whole time, and it was only suddenly—perhaps inspired by something they’ve experienced recently—that they figured them out and got them working. Before the level, they weren’t ready, so they couldn’t be used. Now, they are.
The game doesn’t provide rules for these kinds of things because it’s difficult to create anything one-size-fits-all; campaigns are too different. And really, the expectation is that these kinds of things aren’t meant to actually take up game time really. Still, the books could do a better job of explaining it narratively—the most we get is the Dungeon Master’s Guide saying that you could make leveling up a process, that requires some downtime once you have enough XP, which could be when a wizard works on these two spells. It’s only a suggestion and it won’t work for every campaign, and how to narrate things without doing that isn’t described, even though it’s not too bad, really.
But even so, it does require a bit of “looking the other way”—a wizard doesn’t use up any resources tinkering with these spells, not even pages in the spellbook, nor do they lose XP if they lose their notes or whatever, and the correlation between “figuring out these new spells” and “killed these monsters” may not be as strong as these things are for a fighter or cleric—but at some point, we do have to accept that levels are, from the very beginning, an abstraction to make the game simpler to run.