The Trick Room TM is only available in the post-game of B/W after you defeat the Elite Four. It's located in the Abundant Shrine, west of Undella Town through Route 14.
It's difficult to give directions on this via text but here's a step-by-step tutorial with screenshots on how to reach the TM: https://guidestrats.com/pokemon-bw-tm92-trick-room/
I'll add a screenshot of the TM's location below as well, courtesy of the same tutorial link:
