she needs to understands the difference between better at a subject/talent versus better as a person! that is key I think.
she maybe worried she is disappointing you (daddy, teacher etc)
and are these other kids even better or does she just think they are better?
my DS3 used to get upset about another boy being better at reading. (both top of class!) so we talked about how we are all different and he maybe better at reading, but worse at football and that is OK!
Also that if he wants to get better either for himself or to beat the competition he has to work harder/practice more.
he said he got annoyed because he wanted to learn more
so it could be one or a mixture of these and other ideas people might think of...
I always tell my kids that no matter what the result is it is not acceptable to be lazy and don't do their (own personal) best and yes, I will be disappointed if they are only 2nd if they could been 1st.
On the other hand if they have done their best and max effort and are still last in the race I will be the proudest!
Also you should find out what she can do well & is good at and/or what she find relaxing and enjoyable and focus on these activities for now, that will boost her confidence massively!
she is only 5 after all, she's got her whole life ahead of her for improvement and achievement, for now it's more important to have less pressure and more fun.