Pokemon Sun and Pokemon Moon feature a rare type of Pokemon called Cosmog. You can find out details on how to capture it from here. Keep in mind that this rare Cosmog can only be found once per each copy of the game, which means there is no way to get another Cosmog in the game unless you opt for cheats.
Once you have managed to get a Cosmog, as detailed in this guide here, you can evolve it to Cosmoem and then later Sungaleo or Lunala, depending on your Pokemon game version. You can read more about the version difference between Sun and Moon from here.
To evolve Cosmog into Cosmeom, you will need to level it up to 43. Cosmog will have the following stats in its beginner evolution form.
HP: 43, Attack: 29, Defense: 29, Sp. Attack: 29, Sp. Def: 31, Speed: 37. Evolving it to Level 43 shouldn’t be difficult once you have completed the game.
To evolve Cosmog into your version exclusive Pokemon, either Sungaleo (Pokemon Sun) or Lunala (Pokemon Moon), you will have to level up Cosmeom to 53. Depending on your game version, you will be able to evolve the Pokemon to either Sungaleo or Lunala.
Pokemon Sun and Pokemon Moon is available now for the Nintendo 3DS in North America.