There are dark clouds over the beaches of Malibu, where a storm is raging. It all seems ridiculously out of place – and so does Larry Charles. The director of Curb Your Enthusiasm and Borat may live in the rarefied hills nearby, but as he emerges from the rain in his camouflage jacket, grey hoodie and long white beard, you can’t help thinking he’s exactly the sort of person who would trouble the Neighbourhood Watch.

His latest project, he tells me, was inspired by the feelings of restlessness he experiences living here in Hollywood’s gilded cage. “I didn’t want to wind up being complacent, safe and secure,” says Charles. “That isn’t why I got into comedy. I wanted to seek out what’s funny in different environments. I wanted to ask a member of Isis what they laugh about.”

So he did. At one point in his new documentary series, Larry Charles’ Dangerous World of Comedy, he visits a prison in Kirkuk, northern Iraq, to meet a captured Isis fighter who says his new guards are much funnier than the humourless terrorists he’s used to hanging around with. “He seemed sweet,” says Charles. “You realise there is a face to terrorism that is not the face you think.”

Their interview took place the day Mosul was recaptured by the Iraqi government. Charles could see the battle raging on the horizon. Worse still, traffic was a complete nightmare. “People were trying to get back to their houses,” he says, “even though they were bombed out. In Malibu, when we had to get out of our houses because of the fires, I was able to check into a hotel. That’s not an option in Kirkuk.”

‘He looks exactly the sort of person who would trouble the Neighbourhood Watch’ ... Larry Charles. Photograph: AF archive/Alamy

Charles has lived in the relative safety of Los Angeles since the 1970s when, as a teenager, he came here to sell jokes outside the Comedy Store. “I did standup too,” he says, “but I could never be the funniest version of myself onstage.”

While working as a writer on a sketch show called Fridays, he met Larry David, who would go on to create and star in Curb Your Enthusiasm. David hired him for Seinfeld. It all seems like a simpler era, says Charles. “Seinfeld was a product of its time,” he explains. “We got complacent as a culture. We thought everything was secure and we didn’t expect it to be yanked away. Now there’s a mad scramble. The best comedy reflects the anxiety the culture has.”

Charles’s first film as a director was 2003’s Masked and Anonymous, a strange tale about a rock icon playing a benefit concert for a decaying, dystopian America co-written with and starring Bob Dylan. “He’s hilarious,” says Charles. “He’s not afraid of being misunderstood. He taught me you have to trust yourself, and he does. He doesn’t think twice.”

In his Dangerous World of Comedy, Charles visits places most white Americans would fear to tread, including Somalia, Liberia, Saudi Arabia and a Native American reservation in Minnesota. Just as the late Anthony Bourdain used food to take his fans to parts of the world they couldn’t find on a map, Charles uses comedy as a prism through which to view humanity. “I was a big fan of Bourdain,” he says. “Like me, he’s an older white man trying to be cool in these different situations. And he was. Ultimately, the lesson that I learned, and that he learned, is how similar everybody is.”

In Somalia, Charles meets a defector from al-Shabaab, an extremist group of Islamic militants. The man once laughed at enemy corpses being dragged behind trucks. Now, he mostly hears laughter mocking him for getting brainwashed into joining a terrorist organisation. It’s a startling illustration of the chasm between our desire to make people laugh and our paranoia about people laughing at us.

“People often feel that’s the worst thing that can happen to you,” says Charles, “which means – in a Seinfeldian, Curbian sort of way – it’s also the funniest thing that can happen to you. That’s why I’m always looking for comedy that really isn’t funny. You say, ‘That’s not funny.’ Then you move it 10 degrees and suddenly it’s hilarious, because it’s catharsis.”

Charles cites the first screenings of Borat, the 2006 mockumentary in which Sacha Baron Cohen played a Kazakh journalist travelling through America, speaking to anyone vain, gullible or fried enough to believe he was genuine. It was as hilarious as it was cringe-making. “The audience reacted like it was a horror movie,” he says. “I loved that. People were screaming and looking away. That kind of visceral reaction is hard to manufacture.”

‘Charred human remains taste like pork ribs’ ... Charles tests the limits of absolute free speech with General Butt Naked. Photograph: Netflix

In terms of what can and can’t be said in 2019, Charles says he believes in “absolute free speech”, yet some of the most illuminating moments come when he has to reckon with what that actually means in reality. In Liberia, he meets the former warlord General Butt Naked, who earned that nickname after claiming to have taken troops into battle naked.

The general talks about murdering children, and reminisces about how charred human remains taste “like pork ribs”. He then reveals prosaically that he is a big fan of Kids Say the Darndest Things, the US comedy series hosted by Bill Cosby that ran in the late 1990s. Who would have thought one man could share a taste for both Cosby and human flesh? “Well, to me it’s not that far removed,” Charles says drily. “I never thought, when I was a child, that connection would be made. But here it is.”

Later, Charles finds himself on the receiving end of a determinedly unfunny antisemitic rant by the white supremacist hacker Andrew “Weev” Auernheimer. Then the alt-right troll Baked Alaska tells him that Borat – a movie in which Baron Cohen says of a Jewish woman “you can barely see her horns” – is one of his “biggest influences”. Baked Alaska tells Charles he was excited to meet him because “if anyone’s going to get me, it’s going to be you”. In voiceover, Charles says: “Oh shit, really?”

‘Oh shit, really?’ Alt-right comedian Baked Alaska tells Charles that Borat was one of his biggest influences. Photograph: Netflix

“That threw me,” he says now. “But I know one of the secrets of Borat’s success was how many people took it literally. Some people didn’t see it as a satire – they just saw a rude guy speaking their language.” Did he not feel more responsibility to make sure the audience got the joke? “I don’t think so, in the same way that a poet is not responsible for explaining what a poem is about. You can’t control that. It’s the consequence of freedom.”

He does say, though, that he wouldn’t make Borat the same way now. “Definitely not,” he says. “It was a product of the George W Bush era. It was about that cultural imperialism. It was cashing in on our ignorance about the rest of the world. That’s what this new show is about too.”

Before he moved to LA, Charles grew up in Brooklyn – in Trump Village, the housing project built by the US president’s father. Charles says he will, at least begrudgingly, defend anyone’s right to say anything, but I wonder if he’s concerned this belief leads inevitably to political campaigns run on lies, vague rhetoric and racial slurs. Is President Trump the logical consequence of unchecked free speech? “If he is – and I accept the fact that it’s a possibility – then society created the environment for that to happen. We tend to be very apathetic about what’s going on, and Trump is emblematic of that because he’s apathetic too. He also tries to be funny, but he’s a bad comedian.”

One of the things Charles has found on his travels is that there’s never a subject so dark somebody won’t laugh at it. From General Butt Naked to Donald Trump, the prisons of Iraq to the battlefields of Somalia, he finds humans reckoning with the greatest joke of all: the absurdity of life when faced with the inevitability of death.

“You could say the fear of death drives it all,” says Charles. “That’s a very primal fear, and releasing it is where the deepest and most resonant laughs reside. Once you let go, it’s hilariously funny because it’s so absurd. Why go through it all? That’s still a great question. Comedy is about that question.”

Larry Charles’ Dangerous World of Comedy is on Netflix now.