There are a few different potential explanations for why someone might have a nasty look on their face. It could be that they're actually feeling angry or frustrated, and their facial expression is reflecting that. Alternatively, they could be trying to give off an intimidating or unapproachable vibe deliberately in order to deter others from approaching them. Or, it could simply be that they have resting bitch face (a phenomenon where people's default facial expressions appear slightly hostile even when they're not actually feeling any negative emotions).
If you notice someone giving you a nasty look, the best thing to do is probably just to give them some space and avoid engaging with them if possible. There's no need to take it personally - there could be any number of reasons why they're looking at you that way, and it's not necessarily because they don't like you.