Before he was a celebrity supporter of Donald J. Trump’s, J.D. Vance was one of his most celebrated critics.

“Hillbilly Elegy,” Mr. Vance’s searing 2016 memoir of growing up poor in Ohio and Kentucky, offered perplexed and alarmed Democrats, and not a few Republicans, an explanation for Mr. Trump’s appeal to an angry core of white, working-class Americans.

A conservative author, venture capitalist and graduate of Yale Law School, Mr. Vance presented himself as a teller of hard truths, writing personally about the toll of drugs and violence, a bias against education, and a dependence on welfare. Rather than blaming outsiders, he scolded his community. “There is a lack of agency here — a feeling that you have little control over your life and a willingness to blame everyone but yourself,” he wrote.

In interviews, he called Mr. Trump “cultural heroin” and a demagogue leading “the white working class to a very dark place.”

Today, as Mr. Vance pursues the Republican nomination for an open Senate seat in Ohio, he has performed a whiplash-inducing conversion to Trumpism, in which he no longer emphasizes that white working-class problems are self-inflicted. Adopting the grievances of the former president, he denounces “elites and the ruling class” for “robbing us blind,” as he said in his announcement speech last month.

Now championing the hard-right messages that animate the Make America Great Again base, Mr. Vance has deleted inconvenient tweets, renounced his old views about immigration and trade, and gone from a regular guest on CNN to a regular on “Tucker Carlson,” echoing the Fox News host’s racially charged insults of immigrants as “dirty.”

When working-class Americans “dare to complain about the southern border,” Mr. Vance said on Mr. Carlson’s show last month, “or about jobs getting shipped overseas, what do they get called? They get called racists, they get called bigots, xenophobes or idiots.”

“I love that,” Mr. Carlson replied.

Whether Ohio Republicans do, too, is the big question for Mr. Vance — who will crucially benefit from a $10 million super PAC funded by the tech billionaire Peter Thiel, a Trump supporter who once employed Mr. Vance.

His G.O.P. rivals in the state have had a field day. Josh Mandel, a former treasurer of Ohio who is the early front-runner in the five-candidate field, called Mr. Vance a “RINO just like Romney and Liz Cheney,” referring to the Utah senator and the Wyoming congresswoman who voted to impeach Mr. Trump for inciting the Capitol riot.

Liberals and some conservatives have also dismissed Mr. Vance for cynical opportunism. One Never Trump conservative, Tom Nichols, wrote of “the moral collapse of J.D. Vance” in The Atlantic.

Mr. Vance’s adherence to some of the most extreme views of Trump supporters shows how the former president, despite losing the White House and Congress for his party, retains the support of fanatically loyal voters, who echo his resentments and disinformation and force most Republican candidates to bend a knee.

Yet Mr. Vance’s flip-flops over policy and over Mr. Trump’s demagogic style may not prove disqualifying with Ohio primary-goers when they vote next spring, according to strategists. Although Mr. Vance’s U-turn might strike some as too convenient in an era when voters quickly sniff out inauthenticity, it is also true that his political arc resembles that of many Republicans who voted grudgingly for Mr. Trump in 2016, but after four years cemented their support. (Mr. Vance has said he voted third-party in 2016.)

“Will he be able to overcome his past comments on Trump and square that with the G.O.P. base? Maybe,” said Michael Hartley, a Republican strategist in Ohio who is not working for any of the Senate candidates. He added that Mr. Vance had the lived experience to address policies that lift working-class people “in a way that others cannot.”

Mr. Vance, 37, who lives with his wife and two young sons in Cincinnati, has carefully seeded the ground for his candidacy, appearing frequently on podcasts and news shows with far-right influencers of the Trump base, including Steve Bannon and Sebastian Gorka.

In interviews, speeches and on social media, he has become a culture warrior. He threatened to make Big Tech “pay” for putting conservatives “in Facebook jail,” and he mocked Gen. Mark A. Milley, the chairman of the Joint Chiefs of Staff, after the four-star general said he sought to understand “white rage” in the wake of the assault on the Capitol.

To Mr. Vance, it is a “big lie” that Jan. 6 was “this big insurrection,” he told Mr. Bannon.

In “Hillbilly Elegy,” Mr. Vance credited members of the elite with fewer divorces, longer lives and higher church attendance, adding ruefully, “These people are beating us at our own damned game.” But that was not his message at a recent conservative gathering where he blamed a breakdown in the American family on “the childless left.’’

Mr. Carlson, Fox’s highest-rated host, all but endorsed Mr. Vance during the candidate’s appearance last month. Mr. Vance also has the backing of Representative Jim Banks of Indiana, a rising conservative leader in the House. And Charlie Kirk, the founder of the right-wing student group Turning Point USA, who has ties to the Trump family, has endorsed the “Hillbilly Elegy” author.

“He has been consistent in being able to diagnose the anxieties of Trump’s base economically almost better than anyone else,” Mr. Kirk said in an interview. Although Mr. Vance once mocked Mr. Trump’s position that a southwest border wall would bring back “all of these steel mill jobs,” today he supports the “America First” agenda that reducing legal immigration will increase blue-collar wages, a link that many economists dispute. “Why let in a large number of desperate newcomers when many of our biggest cities look like this?” Mr. Vance said recently on Twitter over a picture of a homeless encampment in Washington.

Mr. Trump has met with all five major declared Ohio Republican Senate candidates — who are seeking the open seat of the retiring Senator Rob Portman — but has not signaled a preference. He is not likely to do so any time soon, according to a person briefed on his thinking. Among Democrats, Representative Tim Ryan has the field nearly to himself. Ohio, once a battleground state, has trended rightward in the Trump era.

Mr. Vance declined to be interviewed for this article. But an examination of his embrace of Trumpism through the ample record of his writings and remarks, as well as interviews with people close to him, show that it happened the way a Hemingway character famously described how he went bankrupt: “Gradually, and then suddenly.”

The year 2018 appears to have been the turning point. That January, Mr. Vance considered a Senate bid in Ohio but ultimately decided not to run, citing family matters, after news reports brought to light his earlier hostile criticism of Mr. Trump.

Later that year, the furious opposition on the left to the Supreme Court nomination of Brett M. Kavanaugh was a milestone in Mr. Vance’s political shift. Mr. Vance’s wife, Usha, whom he met in law school, had clerked for Justice Kavanaugh. “Trump’s popularity in the Vance household went up substantially during the Kavanaugh fight,” Mr. Vance told a conservative group in 2019.

Although Mr. Vance has said that he came to agree with Mr. Trump’s policies on China and immigration, the most important factor in his conversion, he told Mr. Gorka in March, was a “gut” identification with Mr. Trump’s rhetorical war on America’s “elites.”

“I was like, ‘Man, you know, when Trump says the elites are fundamentally corrupt, they don’t care about the country that has made them who they are, he was actually telling the truth,’” Mr. Vance said.

(His adoption of Trump-style populism did not inhibit him from flying to the Hamptons last month for a fund-raiser with Republican captains of industry, as reported by Politico.)

Finally, the influence of Mr. Thiel, a founder of PayPal, whom Mr. Vance has called a “mentor to me,” appears to have been decisive in Mr. Vance’s embrace of Trumpism.

An outspoken and somewhat rare conservative in Silicon Valley, Mr. Thiel addressed the 2016 Republican convention and advised the Trump transition team. He is a fierce critic of China and global trade and a supporter of restrictionist immigration policies, and Mr. Vance has moved toward all those positions. Mr. Thiel, who did not respond to an interview request, is also paying for a super PAC for another protege, Blake Masters, in a Senate race in Arizona.

In March, Mr. Thiel brokered a meeting between Mr. Vance and Mr. Trump at Mar-a-Lago, the former president’s resort in Florida. Mr. Vance made amends for his earlier criticism and asked Mr. Trump to keep an open mind, according to people briefed on the meeting. If Mr. Trump were going to attack Mr. Vance — as he has other Republican 2022 candidates around the country whom he perceives to be disloyal — he probably would have done so already.

For now, the former president’s appetite for revenge in Ohio seems to be sated by attacking Representative Anthony Gonzalez, a Republican who voted for impeachment in January. Mr. Trump held a rally in the state in June to back a primary challenger to Mr. Gonzalez. Mr. Vance was on hand, sharing a photo on Twitter to show his support for Mr. Trump.