to get cosmog you need to already have been doing the locker event, then go to lake sun, after that, go to the altar of the moon with lunala in your team at day and you will be able to get through a portal. after that, go to the temple of lake moon, and you will have a cosmog