When Pita Limjaroenrat was a student at Harvard in 2008, he shadowed his American classmates who were campaigning at the time for former President Barack Obama. The experience gave him a window into electoral politics, from phone banks and polling data to knocking on doors and putting campaign flags on front lawns.

Fifteen years later, Mr. Pita said he used what he learned in Massachusetts to help his recent campaign in Thailand, where he stunned the country’s political establishment by leading his progressive Move Forward Party to a momentous victory.

For decades, Thai voters had known only two dominant political forces: one led by conservative royalists and militarists and the other by a populist billionaire living in exile.Supporters saw Mr. Pita, 42, as the candidate who represented change and a return to democracy after nine years of military rule that was preceded by a coup. On the stump, he promised to undo the military’s grip on Thai politics and revise a law that criminalizes criticism of the monarchy.

But his path to prime minister remains uncertain.

“What I need to do now is to find a road-map that bridges that gap between a functioning democracy and half-baked democracy at the very end of nine-year rule by a military coup,” he said in an interview with The New York Times.

In order to take the role, Mr. Pita needs to gather enough support in the 500-member House of Representatives to overcome a 250-member, military-appointed Senate. To be precise, he needs 376 votes. So far, he only has 314.

Already, several senators have said they would not support a candidate who so threatens the status quo. Now, Thais are waiting to see if their choice will be allowed to lead or if he will be blocked from becoming prime minister by prevailing powers, an outcome that could plunge the country into political chaos.

Thai generals rewrote the Constitution in 2017 so a Senate stacked with military allies could jointly determine the top leader. Conservatives are counting on an Election Commission complaint that has been filed against Mr. Pita for failing to disclose that he owned shares of a now-defunct media company that he inherited from his father.

So far, Mr. Pita has brushed off the petition to investigate him, saying he had already reported the shares to the authorities. He also said he believed there was a group of senators who had “felt their conscience” and understood the consequences of going against the 25 million Thais who voted for change. Only 14 senators have indicated that they would vote for him.

Mr. Pita graduated with a joint degree from the Harvard Kennedy School and the Massachusetts Institute of Technology’ Sloan School of Management. From his time in the United States, he learned how to map out a campaign strategy, which he put to use in this election by using data to reach voters in 160 districts.

Most of Mr. Pita’s career was in consulting and business, as a managing director of the rice-bran oil business that his father started, and then as a senior executive for Grab, the ride-hailing company that acquired Uber in Southeast Asia.

As a candidate, Mr. Pita developed a reputation for being a clear orator, winning the public over with his speeches and polished looks.

He said he admires José Alberto “Pepe” Mujica Cordano, the former president of Uruguay, who was tortured and imprisoned during the country’s military dictatorship. He is reading “It’s OK to Be Angry About Capitalism” by Senator Bernie Sanders. Some of his favorite bands are Metallica, The Strokes, and Rage Against the Machine. One viral video on TikTok shows a Thai woman holding a mock marriage ceremony with a cutout of Mr. Pita, who is divorced and has a young daughter.

“For a lot of the middle class, especially upper-middle class Thais, he’s like the ideal son-in law that you’d like to have — very educated, accomplished, good-looking, poised,” said Duncan McCargo, a political science professor at the University of Copenhagen.

Mr. Pita was drawn to the ideas of the founder of the Future Forward party, Thanathorn Juangroongruangkit, in 2018, and within a few months was asked to join. He became the leader of Move Forward after Thailand’s Constitutional Court dissolved Future Forward in 2020 and barred its senior executives from politics for 10 years.

If his bid for prime minister is successful, Mr. Pita has promised to reset Thailand’s foreign policy, saying the country would “not be part of the Chinese umbrella or the American umbrella,” but will have the ability to determine its own destiny, Mr. Pita said. In March 2022, after Moscow invaded Ukraine, he wrote on Twitter that the Russians must “retrieve” their troops immediately.

“A lot of it is personal,” said Fuadi Pitsuwan, a fellow at Chiang Mai University and foreign policy adviser to Mr. Pita, referring to the candidate’s strong reaction to the invasion. “He will be a foreign policy leader, which, in Thailand, is rare.”

Mr. Pita’s reputation has not gone unscathed. His ex-wife, Chutima Teepanart, an actress with whom he shares a daughter, accused him of domestic violence in 2019. A family court found Mr. Pita not guilty of the charge. Ms. Chutima did not respond to multiple requests for comment.

In an interview, Mr. Pita said “there was no domestic violence, whether it’s physical abuse or emotional abuse, ever in my family.”

Mr. Pita was born to a wealthy, well-connected family. His late father served as an adviser to the agriculture minister, and his uncle was once a close aide to Thaksin Shinawatra, the populist billionaire whose youngest daughter was one of Mr. Pita’s rivals in the election.

His uncle was a former commerce minister in the early 1980s but was later jailed for misconduct when he was a banker, a case that Mr. Pita described as politically motivated. A salient childhood memory includes visiting his uncle in prison, which made him see “how dirty or how brutal politics could be,” he said.

Over the years, Mr. Pita said he was struck by how Thailand seemed constantly trapped in a cycle of political turmoil, precipitated either by people “using the king to destroy a political opponent or using the monarchy as an excuse to fight for something.”

He started studying other countries with constitutional monarchies including England, Japan and Norway, and said he began to see why the relationship between the Thai monarchy and the people was “going downhill” with each passing decade.

With Move Forward, he wants “to have a comprehensive discussion in Parliament about what the role of the monarchy in a constitutional democracy should be in modern Thailand,” an idea that was once considered taboo among many Thais for whom the royal family has become a fixture in daily life.

In a response to calls for checks on the monarchy’s power — precipitated by protests in 2020 — the military and royalists have come together to defend the institution.

In the aftermath of the protests, Prime Minister Prayuth Chan-ocha, the general who led the previous coup and whose party was trounced in the election, ordered a crackdown. More than 200 protesters, including 17 minors, have since been detained for criticizing the monarchy.

During a final rally before the vote, Mr. Pita reminded the crowd that even a 15-year-old girl had been among those detained for violating the royal criticism law. On Monday, he spoke in front of thousands of his supporters as they celebrated his election victory.

Standing in front of a giant portrait of the king in the center of Bangkok, he addressed the crowd, telling them “a new day for the people has arrived.”

Ryn Jirenuwat and Muktita Suhartono contributed reporting.