Cosmog is one of the new Legendary Pokémons in Sun and Moon, and he will eventually evolve into the Pokémon on the front cover of the game box (Sungaleo / Lunala). He is pretty easy to obtain, and you need to do the following:
1) Complete the main story in the game. This includes becoming the Champion.
2) Head to Altar of the Moone if you play Pokémon Sun or Altar of the Sunne if you play Pokémon Moon. Enter the portal in this area.
3) Go over to Lake of the Moone/Sunne, and walk to the top and onto the platform.
4) This will trigger a small cutscene, and you will add Cosmog to your party/Pokébox. The new Cosmog will be level 5.
Cosmog will evolve into Cosmoem for both games by leveling, and eventually into Sungaleo or Lunala.