Typo fixed, thanks.
Fair question! It does not explicitly say so here. I infer it from a few things.
1. The phrasing- the magic-user adds the spell. This implies to me that it is a product of their research and study to gain the level.
2. They are not described as being granted one by their master. And in fact there may be no master, as the training rules specify that if you have a performance rating of 1 or 2, or if you've reached name level, you don't need one. Contrast this to 1st level, where the DMG explicitly outlines how to determine which spells their master gave them. And also to B/X, for example, where an MU or Elf is described as always being trained by a higher level master (though B/X specifies that either the player or DM may choose the new spell). If they're not being given one by a master, then I infer that it must be the product of their research.
3. It's also implied by the PH section on % chance to know spells under Intelligence, which tells us under the Chance to Know Each Listed Spell entry (PH 10) that the player selects spells in any desired order to check their ability to learn them.
It's a weird meta-procedure, but I've heard of some folks going through a process that whenever an MU gains a new spell level (including at character creation) they go through the list of all spells for that level (in any order they wish, per the above reference) and determine all the ones their character can know. And that they don't actually add the spells to their book until they find them or acquire them on gaining a level, but once they either find it or gain a level, they can add a spell they've passed that check on to their book.