Why when im alone with him he talks politely bit when one of his friends show up he changes his behavior?

He starts talking like of i was a man he calls names ( bit’´h, f’ck..)
Why when im alone with him he talks politely bit when one of his friends show up he changes his behavior?
Post Opinion