Bragging as an identity-reinforcer
You know that guy. He can't help but tell you how great he is. He wants you to believe him so that he can believe it vicariously through you.
The act of bragging convinces others, and in turn yourself, that you are the thing you claim. The validation from others then reinforces the identity you seek.
If you don't feel like a successful person, driving a successful car may convince others that you are. In doing so you convince yourself too that you're successful.
I'm sure this sounds duh to many but it's a genuine curiosity on my part. I've always worked from the angle of "if you have you say it, you ain't it", therefore bragging as a tool occupies the same low level as begging. A brag tells me it's partially false information with dubious intention.
But maybe it has its place when one is trying to build a new internal identity. You may wanna think of yourself as an artist, a writer or something even more nebulous. You're not quite convinced about it deep down regardless of objective achievement.
Perhaps bragging is a lot people's way of faking it till they make it.