In his speech on offensive jokes, UK comedian Daniel Sloss discusses why comedians are the only storytellers to get in trouble for the stories they tell. He notes we all tell stories, and we all tell them in different ways. As a successful stand-up comic himself, he identifies comedians as desperate storytellers, whose job is to make their audience laugh.
Like actors taking on a role, comedians are also playing a more exaggerated (and often more stupid) version of themselves. They do this in order to make people laugh and to be liked. According to this speech on offensive jokes,
comedians don't want to offend people because that's not their job.
Sloss explains people become offended on the behalf of other people who are rarely offended. There is also a difference between saying jokes about people rather than to them, which can also result in people getting upset. But when 'offensive' jokes are told without providing the context, setup or audience reaction, people forget a story is just a story and a joke is just a joke.