Counter-Strike: Source is the more useful of the two. Its models, textures and materials are referenced far more often in Garry's Mod add-ons and maps, so buying it gets you a larger usable asset library.
Team Fortress 2 is excellent in its own right and contributes plenty of content too, but if your reason for buying is specifically to expand what Garry's Mod can do, Counter-Strike has the broader footprint.