The Pete Davidson origin story begins in terrifying fashion. He barrels down the highway in a brown Buick sedan, eyes shut like a kid holding his breath, until he finally opens them and barely swerves from hitting a line of traffic-stopped cars.

The scene is no fiction.

This game of chicken is something Davidson, the comedian and “Saturday Night Live” cast member, did regularly after he got his driver’s license as a teenager.

“I used to think if something bad happened, it was supposed to happen,” Davidson says in a Zoom interview from the basement of the Staten Island home he shares with his mother, Amy. “So I would just test myself and test to see, like, if I belong here.”

He pauses.

“It doesn’t make any sense,” he says. “It sounds like something an idiot would say. But in that time when I was going through that, it was a regular thing I did.”

Davidson is now 26, a six-year SNL veteran, and yet his work as a performer has often been overshadowed by his personal life. Battles with depression. Rehab. An engagement and split with Ariana Grande. His public persona can be hard to track. He appears on “Weekend Update” wallpapered in tattoos, giggling, dusted in attitude and hidden behind self-deprecating punchlines.

“The King of Staten Island,” which he stars in and helped write, should change the way he’s perceived when the movie debuted on-demand June 12. Directed by Judd Apatow and with a cast that includes Marisa Tomei, Bill Burr and Steve Buscemi, “The King” is a powerfully written comedy that, in less gifted hands, might collapse under its own pathos.

Davidson plays Scott Carlin, the perpetually stoned, tattooed and anxiety-ridden 20-something who was 7 when his firefighter father, Stan, died in a building collapse. The real Davidson was also 7 when his father, Scott, died on 9/11 at the age of 33 after entering one of the smoldering World Trade Center towers. There is more that the actor and his character share. Both have Crohn’s, the debilitating digestive disease, love video games and struggle with depression and insecurities. The biggest difference between the actor and the character he plays is that Scott wants to become a tattoo artist, not a comedian.

“That guy is definitely close to me, like, five years ago,” says Davidson. “All those experiences are definitely real.”

Davidson has always credited stand-up with helping to save him. He began performing at 16, egged on at a Staten Island bowling alley one night by some friends. He rose quickly, landing on MTV by 19 and then scoring a small role in Apatow’s “Trainwreck” in 2014. He made an immediate impression on one of the movie’s co-stars, SNL cast-member Bill Hader, who recommended Davidson to Lorne Michaels. And at 20, Davidson joined the ensemble. In a world that embraces misfits, Davidson has found mentors in Hader, Apatow and former SNL writer John Mulaney. Pamela Adlon, who plays a divorced mother in the movie, describes him as easy to love, “just like a giant puppy.”

“I had only met him once,” she says. “And he was very open with me when we were shooting our scenes. When he was telling me about his issues and medication and things like that, anxiety, this is something that is kind of prevalent thing for young people now, so it’s not something that was like shocking. But I learned about who he is from those few days.”

Apatow and Davidson began talking about making a film more than two years ago. They first worked with SNL writer Dave Sirus on another scripted comedy before abandoning it. Then Davidson told Apatow his idea for a film about his life. At first, Davidson wanted to center it on his mother finding a relationship — or, as he describes it, “my mom banging and dating a bunch of dudes.” He felt guilty about how his mother had set aside her own life to help raise him and his youngest sister, Casey.

“I told him I thought that’s the wrong movie,” says Apatow. “How you would do it is she would actually meet somebody and it would make you uncomfortable. That’s what began the conversation of, ‘What if it’s a firefighter?’ And the next conversation was, ‘Do you want to look deeply at that?’ ”

In his stand-up and on SNL, Davidson has never been afraid to reference his late father, particularly if the mention could deliver a kind of shock laughter.

“I lost my dad on 9/11,” he said at a Comedy Central roast of Justin Bieber in 2015, “and I always regretted growing up without a dad. Until I met your dad, Justin. Now I’m glad mine’s dead.”

The invitation from Apatow gave Davidson a chance to explore his father’s death without only worrying about a punchline. He could go deeper. He could also create a piece of art, something that might give him a chance to be better understood.

“When you become fodder for tabloids, you don’t really have a say in how you’re perceived or the truth or any of that, for that matter,” says Davidson. “So I really took advantage of this opportunity to show how I truly feel. And I think that there’s something beautiful in that. And I’m very grateful that Judd allowed me to do that.”

It was not easy making a movie about his life. “The King of Staten Island” required extensive shooting at a firehouse. The smell reminded Davidson of his dad. There was also a tense scene where a group of firefighters, including John Sorrentino, who worked with Scott Davidson and was one of several nonactors cast in the film, run into a burning building. After they enter, Apatow’s camera remains on Davidson’s face. There are no wisecracks, only silence as his eyes search and try to take in the chaos.

“I’m watching it like, oh, that’s my dad going in there,” says Davidson. “I don’t think I could have done this without Judd and all the boys.”

Or Tomei, who describes Davidson as “super vulnerable in a way that makes it easy to get close to him.”

“When Judd and I first talked about doing this together, he said, ‘I just want you to understand where Pete’s coming from and that you and I should look out for him,’ ” she remembers.

In casting, Apatow said that he wanted to surround Davidson with friends and family. Stephen Davidson, his paternal grandfather, delivers a scene-stealing bit on the absurdity of higher education. Other small roles went to his sister Casey; Derek Gaines, a comedian and onetime roommate; and rapper Machine Gun Kelly. Ricky Velez, a comedian who has known Davidson for a decade, plays one of his Staten Island buddies.

In an early scene, Davidson’s character is hanging with friends in the basement, watching a zombie movie and smoking weed. A new girl learns of his father’s tragic death and begins to ask questions. Davidson shrugs and looks hurt. The others scold the girl and demand she apologize. As soon as she does, they burst into laughter.

“We talk about his dead dad all the time,” Velez says and launches into a “knock-knock” joke that isn’t in the script.

“Who’s there?” says Davidson.

“Not your dad,” he says and they all howl.

“Only your best friend would know that he could tell that joke,” says Apatow.

Perhaps the film’s most unexpected performance comes from Bill Burr as Ray Bishop. The veteran stand-up, who is 52, plays a firefighter with a temper, a horseshoe mustache and a personal history he hides from Tomei, who plays Davidson’s long-suffering mother. Ray becomes her first relationship since her husband’s death nearly 20 years earlier.

Burr and Davidson have a history. Amy Davidson took her son to see Burr perform in 2011 in Atlantic City. She engineered a meeting between the then-16-year-old Davidson and the comic.

“You were this tall, lanky kid,” says Burr during a Zoom interview with Davidson. “And then years later I saw him and I was immediately blown away by his poise, his comfortableness with the crowd. If it got a little silent, he’d just stay with what he was doing.”

“I asked him if he had any advice,” Davidson remembers of their first encounter. “He told me not to sign anything.”

The tension between the older man and the stay-at-home son is the film’s catalyst. Ray’s presence forces Scott to confront his father’s memory and try to move through that unresolved pain. Scott, in turn, drives Ray to consider his own flaws, including the limitations of his tough-love approach.

Late in the film, the characters’ relationship explodes into the physical. In Scott’s backyard, they begin screaming at each other before Davidson, in a particularly taunting fashion, kisses Burr on the forehead. They end up on the ground, Burr on top of Davidson, holding his arms as the younger man, in terrifying fashion, howls “let me out, let me out.”

“It’s like what my uncle would do to me when I was 6 years old,” says Davidson. So it brought me to that place where I was just like, you just scream like a baby, you know?”

The movie was supposed to come out in theaters, but the shutdown over viral pandemic concerns altered that plan. Apatow decided that rather than hold it until 2021, the film would actually relate to what people are going through now with the novel coronavirus. The film is also, in part, about first responders and trauma. “It felt wrong to hold it back,” he says.

These days, Davidson is doing one of his rare print interviews — he’s far more comfortable on podcasts and talking with people he knows — in front of a screen. There are video game consoles in the background. He occasionally lights up and takes a drag of something the camera can’t make out, or flips his baseball cap around so it’s on backward. He laughs easily but tends to shy from over-intellectualizing his work. He is proud of the movie, but tends to get most excited as he talks about his friends getting star turns: Velez prompting him with the knock-knock joke. A bit that he and Burr crafted to play off the futility of the New York Jets. The moment Derek Gaines, his comedy pal, does his pop-and-lock dance after a mock fight during a restaurant scene.

But, most of all, Davidson hopes “The King of Staten Island” can help resolve a major part of his life.

Before filming, as he and Apatow scouted locations for the movie, a group of Scott Davidson’s firehouse buddies met them for breakfast, to talk about his dad. The firefighters returned later, during a filmed hangout in a bar that ended with Burr, Davidson and the rest of them serving as extras as they danced to the Wallflowers’ song, “One Headlight.” It was Scott and Pete Davidson’s favorite song.

“To be honest seeing it on screen feels really releasing,” says Davidson. “Like, maybe, I could put this part of my life behind me and move forward.”