Monsters can upcast spells just as characters can
The Monster Manual's section on "Spellcasting" states (page 10; emphasis mine):
A monster with the Spellcasting class feature has a spellcaster level and spell slots, which it uses to cast its spells of 1st level and higher (as explained in the Player's Handbook). The spellcaster level is also used for any cantrips included in the feature.
The monster has a list of spells known or prepared from a particular class. The list might also include spells from a feature in that class, such as the Divine Domain feature of the cleric or the Druid Circle feature of the druid. The monster is considered a member of that class when attuning to or using a magic item that requires member-ship in the class or access to its spell list.
A monster can cast a spell from its list at a higher level if it has the spell slot to do so. For example, a drow mage with the 3rd-level lightning bolt spell can cast it as a 5th-level spell by using one of its 5th-level spell slots [...]
The first bolded section shows that monsters follow the usual spellcasting rules, and the second shows in particular that they can upcast spells into higher level slots that they possess.