Steam have made it rather confusing recently.
There is your Steam ID, which you use to log into your account. This can be an email address (for the hardcore oldschool users) or just a unique nickname. This is your username for Steam and is used to login. You do not have to use this as your in game name.
Then you have your Steam Community ID, which is just a name, used on your mini myspace style comunity page. It can be changed. The plan is to link this into new games. At the moment TF2 is the only game that uses the comunity name, your in game name in TF2 is always your comunity name, you cant change it in game. Your community name is also the name that shows up on your friends list. Just to confuse things your direct link to your community page can again be chosen by you, but as long as its unique, it doesnt have to be the same as anything else.
Finally there is your player name, the name you use in all Steam games except TF2. This can be whatever you want it to be.
Personally, i have my ingame name set to the same as my community name (Skeeter) so that it matches up with my friends list, but my SteamID is different (Adman1020).
Just to add more confusion, if you want to add someone to your freiends list you need their Steam ID, not their comunity name. Basically, think of your SteamID as your MSN Messenger email addess, and your community name/Friends name/In game name as your screen name in MSN.
Hope this helps :S
EDIT: oh yeah, and stats are linked to your unique Steam ID that Valve uses, that is a random mish mash of numbers and letters that looks like a Mac address, that you never need to know.