NEW YORK – The similarities between Freddie Mercury and Rami Malek are striking. In fact, they're guaranteed to blow your mind.

The late Queen frontman and actor who portrays him in "Bohemian Rhapsody" (in theaters Friday) are both the children of immigrants. Mercury was born in Zanzibar to Parsi parents, who moved their family to England when he was 17; Malek hails from Los Angeles, and his mother and father are Egyptian.

And like Mercury, who was teased incessantly as a kid for his real name, Farrokh Bulsara, people still stumble over Malek's name.

"One time during an interview on a red carpet, I saw it spelled out phonetically (on a teleprompter) as 'Raw-meat,' " says the Emmy winner (for USA's "Mr. Robot"). "I thought, 'You can do better than that.' "

The parallels in their backgrounds "were the things that demystified him for me, and that feeling of being a fish out of water was very relatable," Malek says. But it was also their differences that drew Malek, 37, to Mercury, who died of AIDS in 1991 at age 45. The idiosyncratic rock legend's rapid rise to fame with Queen and tumultuous life in the spotlight are chronicled in the long-gestating "Bohemian," which was set to star Sacha Baron Cohen before he dropped out of the project in 2013.

Malek considers Mercury a "genius" and has been a lifelong fan of Queen's music. (They're "very catchy tunes, but the depth of them, you can read into for days," he says.) But despite studying theater at the University of Evansville in Indiana, he didn't know how to sing, dance or play piano before signing on for the biopic in 2016.

While Mercury was flashy, jocular and bisexual, Malek is reserved, intense and straight. (He's best known for playing mentally unstable hacker Elliot Alderson in "Mr. Robot" and has recently been linked to his "Bohemian" co-star Lucy Boynton.)

He knew he had the performance in him, though, and after a six-hour meeting, producers Denis O'Sullivan and Graham King were equally convinced.

"I said, 'I'm going to tell you something that you're probably not going to believe, but I bet you I can move like that dude. Don't ask me why or how, but my body moves in very mysterious ways,' " Malek says. "That was the thing they both laughed at in the moment, and something they both connected to."

Says King: "There's something in his DNA that he took on this character and said, 'I know I can do this.' " For the actor, "it wasn't just about studying Freddie's moves – it was being Freddie's inner self. Because otherwise, that's just an impersonator."

Malek moved to London months before shooting started and started working with a vocal coach. (Although the film primarily uses Queen recordings and Mercury soundalike Marc Martel, Malek's vocals can be heard in a cappella performances.)

First reactions:Rami Malek is an 'amazing' Freddie Mercury

Also:Rami Malek 'totally understands' criticism that Queen film straightwashes Freddie Mercury

More:Rami Malek rocks as Freddie Mercury, but 'Bohemian Rhapsody' isn't a killer Queen biopic

To fully embody Mercury's lithe, theatrical movements, he worked with choreographer Polly Bennett (BBC America's "Killing Eve"), who devised unusual exercises such as having Malek deliver "Killer Queen" in the style of Marie Antoinette or lunge across the dance studio as if cross-country skiing.

By the end of filming, "I was almost choreographing my own pieces," Malek says. "What we needed was spontaneity. If I ever tried to just mimic his move, it would play false and everything Freddie did was in the moment."

Similarly helpful were the false teeth he wore to look and sound more like Mercury, who was known to use his hands to shield his distinctive buck teeth during interviews.

"As soon as the teeth went in, I found myself covering up my mouth just like (he did)," Malek says. “My insecurity kicked in, and I found my posture getting better. I realized there was a compensating happening, in a weird way, because I had to try to dignify myself, which was so painful to think of what he might have gone through."

Malek says playing Mercury was the hardest work he has ever done as an actor, but it has so far paid off: Despite middling reviews for "Bohemian" itself, critics have near-unanimously praised his chameleon-like transformation, and he's widely predicted to earn an Oscar nomination for best actor.

The honor would mark a satisfying end to what has been a long, often uncertain road to the big screen: Production on "Bohemian" halted abruptly last December when director Bryan Singer stopped showing up to set amid multiple allegations of sexual assault that he has denied. Dexter Fletcher was hired to complete the film, although Singer still retains the directing credit.

"It was very tricky, obviously," Malek says. "I had put so much work into this character that I often felt like there were moments where – it’s not that I didn’t need a director, but I had a very strong point of view on what I wanted to do every day."

The drama has also been criticized for seemingly "erasing" Mercury's bisexuality, which Malek says he understands: "There were conversations left and right about how to incorporate more of that story into this film. ... Freddie Mercury is a gay icon, and he's an icon for all of us."

Next up, Malek is getting ready to shoot the fourth and final season of "Robot," which returns next year. He also is writing a film that will be his directorial debut, which he promises "is a bit more quiet than the things I've been doing."

As for whether he has braced himself for the next-level stardom that could accompany "Bohemian," Malek says he's still learning to navigate fame.

"There are aspects of it that will take some getting used to that I don't know if I'll ever get used to," he says. "I appreciate a certain sense of solitude and anonymity that I'm going to try my darndest to hang on to. This will probably make it a little more difficult."