As the narrator refers to Ash and friends as 'Our heroes' he might have some supernatural sense sensing Ash's hero sense. Or a connection to Team Flare like AZ or that inspector guy from older series. Maybe he has a mega Lucario and it can sense Ash's aura. Maybe it's co-incidence. Maybe he is a hired assassin?
All we can do at this point in time is speculate, but most likely they crammed him is to make mega evolution make more sense.