Growing up, Daniel Radcliffe always thought Harry Potter would die at the end of J.K. Rowling’s books. “Because of the prophecy with Lord Voldemort,” Radcliffe says on a recent afternoon in New York, between cigarette puffs. “I thought, ‘How is she going to get out of that one?’ ” He finally worked up the courage to ask the bestselling author when she came to see him in the London production of “Equus” in 2007. “I was happy to be proven wrong,” Radcliffe says. “For an actor, what more can you wish for? You get a death scene — and then you get more screen time.”

Even though Voldemort couldn’t finish off Potter, someone else has. The culprit is none other than Radcliffe himself, who was cast to play the boy wizard at the age of 11 in 2001’s “Harry Potter and the Sorcerer’s Stone.” Over the next 10 years, the eight “Potter” installments from Warner Bros. added up to the most successful movie franchise ever, with $7.7 billion in global ticket sales.

Since the series ended in 2011, Radcliffe has worked hard trying to distance himself from Hogwarts. With his latest movie, the romantic comedy “What If,” which CBS Films will platform release on Aug. 8, it appears the actor has finally laid Harry to rest. He plays a smitten medical student who bears no resemblance to his trademark role.

Overcoming typecasting wasn’t easy for Radcliffe. It’s hard enough in Hollywood to transition from child actor to adult star (think Macaulay Culkin or Haley Joel Osment). But it’s even more difficult to escape the indelible mark of a mega-franchise (just ask Pierce Brosnan or Daniel Craig about the challenges of playing any part other than James Bond). Radcliffe, who turned 25 this month, started to realize he’d need a post-“Potter” plan in the middle of the decade he spent with co-stars Emma Watson and Rupert Grint. “When I was 14 or 15,” Radcliffe says, “journalists would come and say, ‘What are you going to do after this?’ I became aware very quickly that the narrative that people wanted to write was that these three guys did ‘Harry Potter’ and faded away. From quite a young age, I was determined not to let that happen.”

Radcliffe, a workaholic who rarely vacations, says he loved acting too much to give it up. Despite a few personal demons (in 2012, he confessed a past problem with alcohol), he’s managed to patch together a formidable career that isn’t easy to characterize. He’s crisscrossed between plays, performing on Broadway three times, most recently in the title role in a revival of Martin McDonagh’s “The Cripple of Inishmaan”; in independent films, such as last year’s “Kill Your Darlings” (as Allen Ginsberg); and in studio movies like 20th Century Fox’s upcoming “Frankenstein,” where he dons hair extensions to portray the hunchback Igor.

Radcliffe explains that each type of acting has its own appeal. “The stage keeps me sharp,” says the actor, whose mom, a casting director in England, used to take him to the theater regularly as a boy. “I feel like I learn and get better every time. Indie movies are honestly where the best scripts are, and I’ll always relish the chance to do big studio movies, because that’s what I grew up doing.” Radcliffe is also starring in “Horns,” a fall fantasy film he plugged last week at Comic-Con, and will make a cameo in the new Judd Apatow comedy “Trainwreck,” in which he plays himself in a movie-within-a-movie called “The Dog Walker.” Apatow pitched Radcliffe the idea in his Broadway dressing room, and he was game. “I’ve never done a movie without a script in my life,” he says.

Radcliffe wasn’t looking to star in a romantic comedy when he came across “What If” more than two years ago. The film’s director, Michael Dowse, wrote him a letter, explaining why the role would be a departure for him. “He’s very hungry to do different things and prove himself in different ways,” says Dowse, who adds that Radcliffe’s casting helped finance the $11 million pic. “It’s his first contemporary role where he’s not in a fantasy land.” Radcliffe plays Wallace, a Toronto med student who falls in love with an animator (Zoe Kazan) already in a relationship. Radcliffe studied old classics such as “It Happened One Night” and “Love Story,” and calls 1981’s “Arthur” starring Dudley Moore his favorite romantic comedy. He regaled Kazan with tales of his past relationships as a trust-building exercise to build onscreen chemistry.

It’s no coincidence that one of the film’s posters features Radcliffe at a diner, with an image that resembles the restaurant scene in “When Harry Met Sally.” The movie is the most charming romantic comedy of the summer. Not that it has much competition. The genre has been on life support of late, replaced by bromances such as “Neighbors” and “22 Jump Street,” which appeal to both female and male audiences. “I believe that genres are only dead until they are not,” says CBS Films head Terry Press, who acquired the film at last year’s Toronto Film Festival for $2.5 million. “When I went to the screening, I was completely skeptical about it. I was reluctant and suspicious, and sat there during the movie, and was completely won over by him.”

Press compares Radcliffe’s performance to those of other leading British heartthrobs. “He reminded me of Colin Firth in the ‘Bridget Jones’ movies,” she says. “And a lot of Hugh Grant.” Radcliffe has heard the comparison before, and he lets out a wince. “Oh man, I’m going to get tired of the Hugh Grant thing,” he says. “I guess it’s just that I view Hugh Grant as somebody who got into a rhythm of doing the same types of movies, and that’s everything I try not to do.”

Radcliffe is such a chameleon, he doesn’t like to live in just one city, splitting his time between London and New York. On the day of his Variety photo shoot, he raced up three flights of stairs at a private New York club, leaving his bodyguard in the dust because he’s worried about being late. It was only by three minutes, and he even had a good excuse. Radcliffe’s girlfriend, actress Erin Darke, and East Coast pals threw him a surprise birthday party at a Ping Pong bar, where he feasted on salted caramel cheesecake. Radcliffe became enamored with the sport on the fifth “Harry Potter” film, after Grint got a table in his dressing room. “One night, me and my hair dresser Will must have played 50 games, just because nothing else was going on,” Radcliffe says. “It was one of those things that starts off friendly, and then you’re fucking furious with each other.”

When he’s not wielding a paddle, Radcliffe has been moonlighting as a screenwriter. He’s already completed a script — a dark comedy about a kidnapping — and he’s mulling over a second story about the film industry. “I would also love to direct,” Radcliffe says, although he acknowledges that might be a few years off. “It’s something I feel like I could be good at, because I listen to people, and I love working with film crews. I’ve been able to watch a lot of directors, and cherry-pick what I think they do well. The mistake I see even really good directors make is that they assume they are the only creative person on set.” Radcliffe insists he’d be more democratic, and value everybody’s opinion.

In a way, Radcliffe’s life might have been easier if Harry Potter didn’t make it out of the final movie alive. On the rare occasions that Rowling even hints at bringing the character back, the pandemonium in the press gives Radcliffe a headache. This month, the questions rose to fever pitch after Rowling published a short story with a graying Potter. “Every time she writes something, I’m like, ‘Oh no!’ ” Radcliffe admits.

Though he’s kept a pair of Harry’s glasses from the first and last films, the odds that he will ever wear them in public are small. “I cannot envisage a set of circumstances where I would play him again,” says Radcliffe, who, at the end of a lengthy response about closing the door on Potter, offers a tiny opening: “Maybe there’s a chance that things go so well, I can go back.” For now, he’s rebuffed offers from Universal Studios to appear at “Harry Potter” events timed to their amusement park openings. “I felt like I had to draw a line,” Radcliffe says. “I’m always going to be incredibly proud of those films, but there comes a point where it feels odd to me to put on the robe.”

Yet unlike other actors who have tried to disassociate themselves from iconic roles, Radcliffe often volunteers stories about Potter. He was even intrigued by a fan letter that suggested he direct any “Potter” remakes. Yes, Daniel Radcliffe reads his own fan mail, especially from the Far East. “Something about the way Chinese translates to English means the letters fall somewhere between free verse and the last chapter of Ulysses,” he says. “They are very poetic.”

He’s grateful to the legions of “Potter” groupies, who follow him to his various projects and camp outside his stage door during runs of his plays. He’ll sign autographs, but not without at least one condition. He recently saw a girl who permanently inked his signature on her hand. “Now when I sign a person’s arm, I say, ‘Do me a favor and promise me you’ll never get this tattooed!’ You might like me now, but you might not be so into me in 10 years.’ ”