Necrozma is a legendary Pokemon in "Sun And Moon," and also in "Ultra Sun and Ultra Moon" and it also has it's own Z-moves, but for now, let's talk about the original "Sun and Moon" version of the Pokemon. Necrozma is a legendary Pokemon, not an Ultra Beast. Its name and the way it looks may make you think otherwise.
How to find Necrozma
Before you go searching for this legendary Pokemon, make sure you have finished the Ultra Beast post-game missions. When you finish all of these missions you'll have the UB "Glutton," or Guzzlord. Looker will mention seeing a black, yet reflective, Ultra Beast flying in the skies of Melemele island.
This, in fact, is the legendary Pokemon Necrozma. Before you go searching for the Pokemon, get some Max Repels. Make sure all of your Pokemon are up to the task of fighting Necrozma. Necrozma can be as high as level 75, but make sure to have at least one pokemon below level 75 and make it your lead Pokemon. The rest of your Pokemon should have Ghost and Dark type moves, they are very affective moves against Necrozma. Now we make our way to Ten Carat Hill next to Professor Kukui's house.
Before entering the cavern, use a Max Repel and choose Tauros as a ride Pokemon. Run through the cave until you reach the large, white stone that can be pushed by Machamp. Do not pust the block out of the way!
Instead, go down the split path to the north slightly behind the location of the large stone and enter the medow-like area where you can obtain Pokemon such as Roggenrolla and Rockruff. If it is not obvious, continue to use the Max repels and make sure your lead Pokemon is under level 75. This is the best way of running into Necrozma.
Now save your game, this is very important.
How to catch Necrozma
As you run around aimlessly in the grass, using Max Repel after Max Repel, you will eventually run into Necrozma. Unless you have a Master Ball, things are going to be tricky, that is why you needed to save before searching for the legendary. Your first Pokemon to be sent out would be a lower level than Necrozma, switch to a Pokemon closer to its level.
Use Ghost and Dark type moves, switching to fightig moves when the Necrozma's health gets low. When its health is low, throw Great Balls at the legendary. You might go through a few to cach it, but eventually it will be yours.
In conclusion
Necrozma is a very powerful Pokemon and can be hard to find and catch, but it is possible. With Necrozma in your team, you will be unbeatable! If your Pokedex was stuck at 99%, you now have 100%, unless you missed something else along the way.