Behavior can be influenced by various factors, and it can be difficult to pinpoint a single reason for someone's actions without knowing more about the individual and their circumstances. However, there are a few potential explanations for your friend's behavior:
Insecurity or jealousy: She might feel threatened or insecure about her relationships with other people, and she might only feel comfortable and secure with her boyfriend.
Attempting to impress her boyfriend: She might behave more politely towards her boyfriend in an effort to maintain a certain image or impression in front of him.
Discomfort or anxiety: She might have anxiety or feel uncomfortable around others, and this discomfort could come across as rudeness. With her boyfriend, she might feel more relaxed and able to be herself.
Different expectations: She may have different standards or expectations for her behavior around her boyfriend compared to others. She might think it's more important to be polite in her romantic relationship, for whatever reason.
Manipulation: In the most extreme cases, this behavior can indicate a manipulative personality where she's nice to those who can offer her something (in this case, her boyfriend) but dismissive or rude to others.
These are just possibilities, and none may be accurate. It might be beneficial to have an open, honest, and non-confrontational conversation with your friend about how her behavior is affecting others, especially if it's causing distress or discomfort. It's possible she may not be aware of her behavior or the impact it's having.