The most charitable interpretation I can give the advice is, "Yeah, you're not skilled at this, and there isn't much I can do to help. But there are likeable aspects about yourself, and they don't shine through if you're constantly focusing on imitating some external model of how to do it right. The best you can hope for is not to have such unforced errors, so that at least you can keep whatever wins come from the real you."
If they think "you're naturally skilled at this", they're usually mistaken.
My charitable version is what people would say if they could be honest and were aware of the relevant facts on the ground.
We have completely different anecdata. I've said and heard people say "be yourself" many times. Rarely have I seen it go awry. Typically the people who say "be yourself" are naturally skilled at social interaction, so they can read whether the person is also able to socialize and make the right decision. But I can see how someone who lacks social skills might repeat the saying without even noticing the level of social skills of the person they're saying it to. Much like what this commenter was talking about: https://news.ycombinator.com/item?id=19702757
My problems couldn’t be fixed merely by someone telling me to “be myself”, but they had the right idea.
It's especially useful in the short term context (let's say you have an interview tomorrow): you don't have enough time to pivot your personality, if you try, the judging person will read your inauthenticity as something fishy and you will increase your odds of missing out on your objective.
But in so many contexts -especially in dating- it gets misinterpreted as long term advice "you are entitled for others to accept you as you are and/or eventually someone will accept you as you are, and your objective X will be met"