you beat him once and than he is combined with lonala (moon) or solgaleo (sun) and you need to beat him again.
than you find him on the way on the ice mountain to catch him.
after that you can go catch nebby. and than combine them for the new necrozma you beat before and use it as one pokemon...