To expand your backpack in Team Fortress 2, you can buy an item from the Mann Co. Store.
When you didn't buy something there before and your backpack gets full, you get a message stating that which has a button saying "Upgrade". I pressed that button and then was taken to a store where I bought a cosmetics item. The email Steam sent me after I bought the item is titled "Thank you for your Community Market purchase". My backpack wasn't expanded.
Apparently, it didn't buy the item from the Mann Co. Store but from the Community Market (which apparently is a different thing).
From this wiki page I now know that there is yet another store, namely the Mann Co. Online Store.
How do I make sure I buy something from the Mann Co. Store? The wiki page I linked to contains a video. What's shown in it look pretty much like what I did.