The famously private comedian and actor opens up about being the subject of a documentary and what it reveals about his personal life.

Neil Berkeley scored a big subject for his second documentary, but it was pure luck that made it happen. Shortly after completing his second documentary, 2014’s “Harmontown,” Berkeley casually mentioned to a friend that he was interested in making a film about legendary comedian and actor Gilbert Gottfried. Unbeknownst to Berkeley, his friend happened to be close with Gottfried’s wife.

“Gilbert” will have its world premiere Thursday at the 2017 Tribeca Film Festival, but the surprisingly poignant documentary could very well have never been made. Berkeley never asked Gottfried’s agent or manager for permission to shoot the documentary, and was only invited to the 62-year-old comedian’s home by his wife Dara.

“She said, ‘Why don’t you just come out here by yourself and keep it low key and maybe Gilbert won’t notice you’re here,'” Berkeley recalled. “I walked in and he was in his bathrobe with some coffee. I said, ‘Dara told me I could make a documentary about you. Did she tell you?'” Gottfried said no, but the foul-mouth comedian doesn’t like to make trouble.

“I’m too nervous to say, ‘Get away from me,’ and he just kept following me,” Gottfried said. “I was pretty much fighting this until the very last day he filmed me.” Despite having a reluctant subject, Berkeley got the famously private Gottfried to open up about being notoriously cheap, a nearly career-ending collection of tweets and unexpectedly getting married and having children after turning 50.

IndieWire spoke with Gottfried this week about his unlikely collaboration with Berkeley and hopes for the film.

What was your reaction when you saw the film for the first time?

It’s very peculiar. I’m much more comfortable watching myself on a TV show as Joe the Plummer. Me as me is really a frightening thing to watch.

You also appeared in last year’s Oscar-nominated documentary “Life, Animated.” Did seeing yourself in that film warm you up to the idea of being in a documentary?

I liked the reaction that I got from people who’d seen it and people tweeting me, but I never got totally warm. It’s kind of like how I kept putting off doing reality TV. Now I find myself doing a bunch. I did “Celebrity Cook-Off,” “Celebrity Apprentice” and “Celebrity Paranormal Project.”

In the documentary, comedian Jim Gaffigan says that comics don’t have a choice about doing stand-up, because it’s an addiction. How do you view doing stand-up?

I’m more about the bread and butter factor of it. They give me a check at the end of the night. But when I was starting out, when I finally decided I would go to the club every night, it became an addiction. There could be a snowstorm and I would have to go to the club. I could have a high fever and it didn’t matter. I would go, and it wouldn’t matter if I bombed. I would come back for more.

You say at one point in the movie that you wish you could enjoy things “more fully.” What were you referring to?

Everything in my life. I remember a time I was booked to judge the Miss Nude Contest and it was just me on stage introducing all these different naked girls. I thought, in these situations, I think anybody else would think they died and went to heaven, and I wish I could enjoy these things. I’m usually there feeling miserable, and feeling even more miserable thinking “Why am I not enjoying this?”

Why don’t you?

I have no idea.

There’s a scene in the movie where you’re at a hotel for a gig, and a bunch of guys dressed up as Nazis from a historical convention approach you. What was that like?

I appeal to strange groups. It was kind of like a scene out of “Cabaret.” Most people who see that scene will think, well, this was all set up and there’s no way this could be true. It was funny because Nazi officers were running up to me wanting to take a selfie with me. Talking to them and hanging out with them, you get this feeling like, gee the Third Reich wasn’t all that bad. They invited me to sit and have breakfast with them.

In 2011, you tweeted some jokes about the earthquake and tsunami in Japan, which led Aflac to fire you as the voice of the Aflac duck. What was that experience like?

They fired me, squeezed loads of free press out of it, and then just hired a guy to imitate my voice, thus bringing closure to a horrible tragedy. It’s mind-boggingly hypocritical because it’s like they want to distance themselves from me by having a guy who sounds like me.

Did you question at the time whether you should make those jokes on Twitter?

I wasn’t all that familiar with the internet, and now I realize if you go on and say “I had scrambled eggs for breakfast,” 10,000 people will attack you for that. I didn’t realize about trolling on the internet and these basically crazy people who feel they have an opinion now who never did before. There were people parked outside the apartment building I lived in who would jump out at me when I tried to leave or come back…I’ve always said the internet makes me feel sentimental about old time lynch mobs, because they had to go out and get their hands dirty. Now they just sit around in their underwear on the couch.

How concerned were you about your career after the Aflac incident?

I really thought it was the world versus me, and then you start to realize that, if your career is truly over, you’re not making a big splash. They never say, “Hey, remember those two guys who replaced the original guys on ‘The Dukes of Hazzard’ when they were on strike? Their careers are over. Our top story tonight.”

How might the documentary’s portrait of you — which is so different from way people understand your career — impact your career going forward?

I usually try not to think about stuff that’s coming out, because early on, with everything you do, you think, “Oh I did this appearance on this show,” or “I did this scene in this movie” and this is going to catapult me into megastardom, and then it doesn’t happen. So now I try to distance myself from everything I do.

People who know you were very surprised when you got married in 2007, because no one seemed to know if you’d ever had a girlfriend. Were you surprised too?

I wasn’t expecting it to happen. The funny thing is, my sister [Arlene] is a photographer, and she was filming one of her [home] movies and it included a clip of my grandmother, who lived to 104, saying I was a homosexual. I think she actually believed it.

How have your feelings about show business changed over the course of your career?

I always felt like the second I knew vaguely how the business worked, it all changed. Now there are so many things where people’s work is being shown where they’re not getting any money. With movies and TV shows, you used to keep track of them. Now there’s no way to keep track of it.