While visiting the Altar of the Moone,
Nebby (Cosmoem) evolved into
Nebby (Lunala) after
Lillie held a ritual and played a Sun Flute while Selene played a Moon Flute and a beam came from the Altar tower, directly aimed at
Nebby (Cosmoem) causing Nebby to evolve into Lunala.