Most cheat commands in the Steam version of Team Fortress 2 require sv_cheats to be set to 1, and you generally can only do that if you're hosting a server. Be aware that enabling it also disables achievements for that session.
Some of the available cheats include thirdperson, impulse 101 (which gives full ammo), the ent_create command (for spawning entities like headless_hatman or eyeball_boss), noclip, and buddha. As for the Xbox 360 version, it's unclear whether equivalent cheats exist. These are mostly for experimenting in your own server rather than public matches.