I just find out how to obtain Cosmog in game
In PKMN Moon take Lunala with you in the post game DURING THE DAY (when in the real world is night) at the Lunar Altar and cross the world shift
Then with Lunala go at the place that now is the Lunar Lake and Lunala will scream, a Cosmog will appear and you don't need to catch him but just to pick it up
Since it appears after the illusion of Solgaleo probably it will evolve in Solgaleo if you're playing Moon and Lunala if you're playing Sun
I'm not sure about the names because I don't paly in english but I hope you all understand the places