This is because Smeargle can't learn any TMs. In fact, it can't learn any move at all apart from its signature move, which happens to be the way that Smeargle learns those moves.
Sketch, Smeargle's signature move, will permanently copy the target's last move. This means that after Sketch is used, it is replaced by whatever move it copied and stays that way even after the battle ends. This means that Smeargle can learn practically any moves in the entire game, including the signature moves of other Pokemon as crazy as that may seem. There are only three moves it can't learn as of Gen 6, the first being Chatter, the second being Struggle, and the last being Crafty Shield (as the moves protects the user from Sketch in the first place). So that means that those trainers you fought must have had their Smeargle Sketch those moves you saw them use in a previous battle.
Smeargle learns Sketch at levels 11. 21, 31, 41, 51, 61, 71, 81 and 91, so you can switch and replace moves as you please.
More info on Sketch if you want it