What I've heard was the opposite; the in-game NPCs never find out the Illusion (unless it breaks, obviously), but the AI completely ignores the ability in the Battle Subway.
I bred myself a Zorua, leveled and trained it for 'competitive' use and I discovered the following by challenging the super singles:
The AI is fooled by your ability, but knows exactly what your ability is.
Confusing? Let me explain.
I had my Timid Zoruark disguised as Gengar.
Metagross spammed Zen headbutt on me.
Machamp hit me with Payback.
Unfezant hit me with aerial ace.
Staraptor hit me with U-turn (which was bad of course, but it could have used close combat aswel).
Slowbro spammed calm minded psychic on me.
Froslass used shadow ball.
Etc.
Obviously the AI thought of me as a Ghost/Poison type. I haven't been hit by a single normal or fighting move yet.
However
Magmortar hit me with earthquake.
Rhyperior hit me with earthquake.
The AI knows exactly that I do not have levitate.
It makes sense I suppose. So, disguised as a ghost you have 3 'immunities'.
Try to get a type that draws in psychic, dark or ghost, cause it will.
Does this make Zoruark good in the subway? Meh. Even after a nasty plot, it often still lacks the force to take down some of it's threats. And you need 2 out of the 3 pokemon slots to set it up.
Anyway, this should at least explain AI vs Illusion.