You go to the café in the alleyway in Castelia City. Then interact with the guy with the guitar by the counter. He plays a song. Then Meloetta comes out of its pokeball and sings. After that Meloetta wants to learn Relic Song which allows Meloetta to temporarily turn into Pirouette form during battle.
P.S. I may be off since I did this a few months ago.Hope this helped.