Sucks if your co-workers think you don't deserve the job. Time to prove them wrong, if that is the case.
But just to be clear, both of you still work for the company, right? So the company keeps both of you on staff, and the one with less experience is going to gain more experience than the one who already has more experience would've gained. So the total increase in experience is going to be more, so there's a good business argument for choosing the less experienced one, as long as they are a quick learner.
Actually, in this specific case, I
do think it is acceptable to make a choice based partly on gender, because you being a woman in a team of mostly men is a positive attribute, and could improve the group dynamic in a deeper way than mere experience. Just as a man in a team of mostly women might. Still, it might be illegal.