Holden has a really dumb hat. Well, it is dumb. Even he admits it:
I put on this hat that I’d bought in New York that morning. It was this red hunting hat, with one of those very, very long peaks. I saw it in the window of this sports store when we got out of the subway, just after I noticed I'd lost all the goddam foils. It only cost me a buck. The way I wore it, I swung the old peak way around to the back—very corny, I'll admit, but I liked it that way. I looked good in it that way. (3.3)
(Need a visual? Check out this selection.)
So, what’s going on with this hat? Notice that he buys the hat in New York on the morning after he left all the fencing equipment on the subway and ticked off the entire team. So we know he's feeling particularly vulnerable at the time, even though Holden would never admit to feeling vulnerable.
And that hat shows up over and over again at important moments—writing the composition about Allie's baseball mitt, staring at himself in the mirror and pretending to be tough after Stradlater punches him, yelling "Sleep tight, ya morons" down the corridor. Meanwhile, he takes it off when he's on the train, going to a bar, in hotel lobbies, and so forth. So while he's all about the hat in private, he's embarrassed or lacking confidence to wear it in public. (Although, fair enough, it was also just considered polite to take your hat off inside, just like today.)
We even get hints to this at the start of Chapter Thirteen ("I took my red hunting hat […] and put it on—I didn't give a damn how I looked"), the end of Chapter Sixteen ("I took my old hunting hat out […] and put it on. I knew I wouldn't meet anybody that knew me"), and the start of Chapter Twenty-One ("I'd already taken off my hunting hat, so as not to look suspicious").
But despite his embarrassment, the hunting hat becomes an important part of the way Holden sees himself. It's a people shooting hat, he declares (we hope not literally). When he's wearing it, he can be as insular and tough and as … individual as he wants—just like Allie and Phoebe, both redheads.
That's why it's such a big deal when Phoebe puts it on his head at the end of the novel: not only is she giving back to Holden, but she's demonstrating that she loves him as the individual that he is—corny red hunting hat and all. (Want to see a cute interpretation of this moment? Check out this image.)