Cosmog first appeared in Secret of the Lake!, where it was created by the spirits of Solgaleo and Lunala. The group, having entered the Lake of the Sunne after Nebby was drawn there, witnessed the event. Cosmog immediately bonded with Nebby, as they were both of the same speices. Realising that this Cosmog was newly-born, Lewis decided he couldn't leave it alone and offered Cosmog the chance to travel with them. Cosmog accepted this and was caught by Lewis.
In The Cracking Dimensions!, despite being told by Gladion to remain hidden, Cosmog escaped from its Poké Ball to try and save Nebby, who had been captured by Lusamine. As a result of this, Lusamine managed to capture Cosmog as well and began draining both Pokémon of their energy, allowing her to open several Ultra Wormholes across Alola. Desperately weak, Cosmog evolved into Cosmoem to conserve its energy.
Later, in Altar Ascensions!, Cosmoem was brought to the Altar of the Sunne & Moone by Lewis, who sought to summon the Legendary Pokémon. After being exposed to the energy inside the Altar, Cosmoem evolved into Solgaleo, alongside Nebby, who evolved into Lunala. Later, Solgaleo used its new power to battle Necrozma, who had emerged from an Ultra Wormhole. Despite putting up a good fight, Solgaleo was thrown back by Necrozma, who proceeded to absorb Nebby and escape to Ultra Megalopolis. Solgaleo followed Necrozma through the wormhole, Lewis and Lillie in tow.
Solgaleo later had a rematch with Necrozma, now in its Dawn Wings form. Despite fighting fiercely, Solgaleo was unable to separate Nebby from Necrozma. Lillie managed to do so by performing a Z-Move with Nebby. Solgaleo then attacked Necrozma by performing Searing Sunraze Smasher with Lewis, although Necrozma absorbed the light from the move and escaped to Megalo Tower, where it transformed into Ultra Necrozma.
In the following episode, Solgaleo, alongside Aipom, Nebby and Poipole, face off against Ultra Necrozma. Eventually, Solgaleo is able to land the finishing blow on Necrozma, finally getting its revenge. In The Mother Beast of All Battles!, Solgaleo participates in the battle against the Ultra Beasts. During the fight, it willingly fuses with Necrozma, transforming into Dusk Mane Necrozma.
Cosmog, in contrast to Nebby, is rather reserved and quiet, although it willingly played with Nebby and the other Pokémon, showing a playful side.
Cosmog also seems to be rather trusting, as it agreed to go with Lewis despite only just meeting him.
After evolving into Cosmoem, it became much more subdued and showed absolutely know emotion.
Upon fully evolving, Solgaleo reverted back to its original, playful personality, happily hugging its Trainer after opening an Ultra Wormhole. Solgaleo proved itself to be a highly resilient Pokémon, repeatedly taking hits from Necrozma over multiple battles without showing signs of fatigue. It, like its Trainer, refuses to give up, repeatedly re-challenging Necrozma until it finally defeated the Prism Pokémon.