Walkthrough: After defeating your seventh Island Trial and having now reached the Alter of the Moone, it is up to you to summon the Legendary Pokemon in hopes of being able to access Ultra Space to help Guzma and Lusamine. As you walk into the Altar, Lillie will suggest the two of you play one flute each on opposite sides of the Altar.
As both of you begin to play in your given spots, the Altar will begin to light up. However, as this is happening, Lillie's bag will begin to move and Cosmoem (Nebby) will break free from her bag. It will float to the center of the Altar, and it will soon glow and actually evolve into none other than said Legendary Pokemon, Lunala.
However, directly after this happens, Gumza and Lusamine are thrown onto the Altar out of a Wormhole. Lusamine will tell you how Necrozma was too powerful for her to stop, that it is a true monster. And just then, Necrozma will appear from its own wormhole, having broken free from the control of the Ultra Recon Squad. Lunala will immediately take it as a threat, sending it and Necrozma into a fierce battle. Unfortunately, Necrozma is just too strong, quickly and easily defeating Lunala. And after doing so, it will absorb Lunala and turn into its Dawn Wings Form.