After breaking so, so bad playing chemistry teacher turned meth mogul Walter White on television, Bryan Cranston was overdue for a hero’s role. But given his predilection for challenging characters, it was bound to be an offbeat, complicated type of lionheart.

Cranston found his man in “Trumbo,” opening Friday. Not exactly a household name today, screenwriter Dalton Trumbo was one of the more influential figures of the infamous Hollywood blacklist years. It was a time when Cold War hysteria bred nationalism run amok, and freedom of speech was sacrificed in the name of the House Un-American Activities Committee’s (HUAC) jingoistic lockstep masquerading as loyalty to country.

Making this story matter to a younger generation feels important to Cranston, he said in a recent interview.

“These men went to jail not because they were guilty of anything, but because a committee didn’t like the way they were answering questions,” he said, his congenial yet authoritative voice growing passionate. “Today, when as a society we’re embracing difference so much more, that’s scary and almost unbelievable.”

Trumbo, who wrote several dozen screenplays over his career, was the most prominent member of the Hollywood Ten, refusing to testify about his involvement with the Communist Party. While many of his peers and friends, including actor Edward G. Robinson, caved to the committee’s pressure, Trumbo was imprisoned for nearly a year for contempt of Congress and barred by skittish studios from writing jobs in the 1950s.

Still, he managed to win two Oscars during those years, one for “Roman Holiday,” with another writer fronting for him, and the other for “The Brave One” under a pseudonym. The awards came to light after director Otto Preminger “outed” Trumbo as the author of “Exodus” and A-list star Kirk Douglas followed suit by naming Trumbo as the guy who fixed the script for “Spartacus.”

“As Trumbo himself said, the blacklist created no winners and losers, only victims,” Cranston said. “This committee abused its power, discarding the First Amendment to become judge, jury and executioner.”

The movie also stars Helen Mirren as gossip maven and HUAC ally Hedda Hopper; Louis CK as fellow blacklisted screenwriter Arlen Hird; Diane Lane as Trumbo’s stalwart wife, Cleo, and Elle Fanning as their like-minded daughter Niki.

One of the more striking aspects of “Trumbo” is how many fun moments there are, given its subject. Cranston’s natural gift for comedy — and his experience playing Dad on “Malcolm in the Middle” — has a lot to do with it. But so did the real Trumbo, who could actually speak in the strings of nimble wisecracks that were a hallmark of films from that time.

“The story isn’t so fun as to be inappropriate, but there was certainly humor laid in there because these men were witty, smart, knew how to craft a joke,” Cranston said. “It’s a sensibility that makes the story more palatable, but it’s also sincere. It’s funny and heartfelt as opposed to important, slow and dry.”

Asked if he had any reservations about playing Trumbo, Cranston said he has a specific method in choosing his roles.

“First, the story has to be rich and entertaining and compelling,” he said. “Second, the script needs to fully support that story. Then, the character has to support that point of view, and the director and the rest of the cast have to be sensitive enough to embrace the story’s nuance and bring it to fruition. If I can check off those four things, I’m on board.”

Bathing in ideas

To prepare, he read up on his subject and learned some interesting side notes about Trumbo, who liked to write his screenplays while soaking in a bathtub.

“He was a contrarian who didn’t go along with the status quo when he saw something wrong,” Cranston said. “He wouldn’t just say, ‘Somebody ought to do something about that’ — he’d do it.

“He was a letter writer. He wrote the electric company to ask why their rates were so damn high. He complained to the school board that his children were given a ridiculous amount of homework.

“It was such irony that they tried to crush him by preventing him from writing. That wasn’t possible.”

For all his courage and admirable idealism, Trumbo was a flawed man as well, and Cranston plays him warts, handlebar mustache and all.

“He was irascible, irritable, opinionated, a blowhard, egocentric,” he said. “Also the unfortunate pressure, the emotional damage, he put on his family. I asked his girls if they were teased at school, and they said it was brutal.”

Since winning four outstanding lead actor Emmys for “Breaking Bad” and a successful turn as Lyndon B. Johnson on Broadway in “All the Way” (which is being made into a TV movie), Cranston still doesn’t take getting plum parts for granted. Playing Trumbo gave him a special appreciation for the freedom to pursue what he wants.

“I have a lot more offers than I would have gotten before, but I do a lot of work to go after some roles,” he said. “I like to work. It’s my voice, my empowerment. If that were threatened — my ability to provide for my family, my dignity — it would be devastating.

“That was what HUAC took away from people. That was their legacy.”