How do NPC players know which moves to choose ?
So, I was battling Cynthia's garchomp and I sent out my own Garchomp .
I killed her garchomp with Dragon Rush.
She sends out Lucario and uses dragon pulse.
So I was pretty curious and sent out Staraptor.
Lucario used close combat.
How do the NPC players know which moves are super effective ?
It's called AI ( artificial intelligence).
Basically the game knows what types are weak/strong against other types and it knew Lucario had Dragon Breath which is super effective against your Garchomp (same with Staraptor).
Artificial intelligence is some pretty complicated stuff so if you want, you can read up about it. (Wikipedia link)