WASHINGTON — When Ro Khanna won his seat in Congress last November, it was the culmination of three congressional campaigns, a decade of political organizing and thousands of hours knocking on doors.

But as Khanna stepped offstage after delivering his victory speech in Fremont, the wonky, tech-friendly congressman-elect quickly realized the new president would in many ways be his polar opposite: someone who pays little attention to the weeds of policy and who has even bemoaned the role of computers in society.

Now, nearly six months into the job, the 40-year-old Khanna is developing his own message about how to help the same disadvantaged, working-class communities President Donald Trump has vowed to protect. He says he’ll do it by helping to create new tech jobs for coal miners and other displaced and disillusioned workers, not by resuscitating the coal industry, as Trump has vowed to do. And right out of the gate, Khanna has ruffled feathers on both sides of the aisle by trying to set himself apart from other Democrats and not waiting his turn as more senior members of Congress take the limelight.

Khanna, who always had a reputation as a political upstart, makes no apologies and says the country needs to get moving on rebuilding its economic engine.

“We’re going through a transition from an industrial to a digital economy, and a lot of people are getting left behind,” Khanna said in a recent interview in his D.C. office, one of the smallest in the Capitol.

Addressing that transition, he said, will take government investment in universities, training programs and internet infrastructure. It will also take the tech industry “stepping up and making the commitment to hire — to look beyond the typical four, five, six typical universities, to make the investments in the country,” he said.

Khanna, who beat eight-term Rep. Mike Honda on his second try, has unveiled some big policy proposals, such as a $1 trillion tax cut for low- and middle-income Americans. He’s traveled across the country to explore how Silicon Valley can help Appalachia and Middle America. And he’s reached out to a raft of Republicans to craft legislation, even as he’s annoyed Democratic colleagues in the Bay Area by joining a liberal group that supports primary challengers to Democrats.

His district, which stretches from Fremont to North San Jose to Sunnyvale and Cupertino, includes the headquarters of Apple, Tesla, Yahoo, Intel and eBay. But some of Khanna’s highest-profile work so far has focused instead on American communities whose economies are threatened by the same technological advances that have fueled a boom for Khanna’s district.

In March, Khanna visited rural Paintsville, Kentucky, in a trip that comes off sounding like an exotic foreign adventure in his speeches to Silicon Valley business groups. He met graduates of a program that’s training former coal miners to code, part of a larger strategy to create a new tech hub in the rolling hills of eastern Kentucky. Some locals call it “Silicon Holler.”

In a community college auditorium that looked a little like a science fair, 34 newly minted coders showed Khanna and other visitors the websites, apps and games they’ve created.

Earl Gohl, co-chairman of the Appalachian Regional Commission, a federal agency focused on developing the region, said Khanna was full of questions for the former miners, quizzing them on their lives and what excited them about the coding class.

“Ro just sort of consumes everything around him; he takes in information like a giant vacuum cleaner,” Gohl said. “He wasn’t giving a stump speech. He wasn’t trying to convince them of anything. He was really there to learn.”

In many ways, Khanna’s district is as different as it gets from that of Rep. Hal Rogers, the Republican who invited him there. Khanna’s is 100 percent urban; Roger’s is 97.6 percent rural. Khanna’s is 57.6 percent white; Roger’s is 96.2 percent white. Khanna’s is 48 percent foreign-born; Roger’s is 0.7 percent foreign-born.

It felt like Khanna “walked in from really a different world,” Gohl said.

Bill Whalen, a former Republican strategist who is now a research fellow at Stanford’s Hoover Institution, said if he were a Democrat running for president in 2020, “I would sit down with Ro Khanna and talk about what he is doing.”

Khanna’s ideas about using tech to empower people in places like Paintsville are missing in most Democratic stump speeches, Whalen said.

“If the Democratic Party is going to get back into power, it’s going to need more than criticizing Donald Trump’s every move,” Whalen said. “It’s going to need an economic agenda that plays well between the two coasts.”

But Khanna’s ideas aren’t exactly taking off in Washington, which has been consumed by the daily rancor over Trump’s latest tweet or the newest revelation in the Russia scandal.

“It’s frustrating because no one came to Congress to deal with a circus,” Khanna said. “They came to solve the country’s problems.”

He thinks the investigations into Trump’s ties to Russia are important, but unlike some of his Democratic colleagues, he’d like to see the political conversation focus not just on resisting Trump and uncovering Russian collusion in last year’s election, but also on economic policy.

“Resistance has a negative connotation,” he said. “California should be the alternate vision. … If Trump has a Sparta vision of America, Silicon Valley has an Athens vision of America.”

Khanna was already a “big dreamer” thinking about running for office when he was a student at the University of Chicago, said Renato Mariotti, who graduated with Khanna and later roomed with him at Yale Law School. In Chicago, Khanna went door-to-door for Barack Obama’s first state Senate campaign in 1996. He and Mariotti also organized a conference about democracy, hosting former leaders of Canada and Haiti, among other dignitaries.

“Most people were doing keg stands in college. He and I were staying up into the wee hours of the morning writing letters to invite people to a conference, or talking about Plato or the Supreme Court late at night,” said Mariotti, who’s now a lawyer in Chicago. “He’s always been somebody who’s unconventional, who does his own thing.”

Khanna, who worked in the Obama administration’s Commerce Department and as a lawyer and Stanford lecturer, first ran for office in 2004, losing a challenge to Democratic Rep. Tom Lantos for his San Mateo County seat in an anti-Iraq War protest bid. In 2014, he ran against Honda, losing by three percentage points. He came back two years later to win by 22 points.

Now in office, Khanna is straddling the line between the tech interests that backed him in his campaign and his more populist policy proposals. He went on Fox News to defend tech companies against charges that they weren’t doing enough to fight online extremism, but was also the first member of Congress to voice concerns about Amazon’s acquisition of Whole Foods.

Tim Bajarin, a Valley tech consultant, said Khanna is “one of us in the sense that he understands the tech industry extremely well,” unlike most politicians. But it’s too early to say how well Khanna is representing industry interests, Valley insiders say.

In Washington, he’s made a big effort to work with Republicans, and some of his government reform proposals could jibe with Trump’s “drain the swamp” rhetoric. He wants to move federal government jobs outside of Washington to cities around the country, and limit members of Congress to 12 years in office.

At the same time, Khanna is the only member of Congress to join Justice Democrats, a liberal organization backing primary challenges to moderate Democrats. As someone who defeated an incumbent, Khanna said he believes competitive primaries lead to more effective representatives.

His decision to join the group hasn’t gone over that well with his fellow representatives, including those in the Bay Area.

“I would hope that when you look at what the Republicans are doing, the Democrats would focus on taking power away from the Republicans instead of having some internecine fights among ourselves,” said Rep. Zoe Lofgren, D-San Jose.

But Khanna defends the move.

“You need a little bit of revolution in Congress,” Khanna said. “You need to shake this place up, because people are angry and they’re upset. That’s what new members do. They refresh the energy; they refresh the perspective of Congress.”