Team Fortress 2 has two different places to buy items. You have the official in-game store where you'll find everything brand new. New items and cosmetics (hats and more) are released here. On the other hand, you have the Steam Community Market which is where users can sell their own items. The Community Market works significantly better for rare items, but comes at the cost of the users setting the prices themselves. The average/starting prices can change at any moment, so it's a gamble to look around here. You can go to the Steam Community Market for TF2 by clicking here. The official in-game store has to be accessed in the game itself, but you can find quick information on the in-game market here at the Team Fortress 2 Wiki page.