BOSTON — Rep. Joe Kennedy, the latest generation of the famous political family to hold office, announced Saturday that he would challenge Sen. Edward J. Markey in Massachusetts’s Democratic primary, a bid certain to divide the party in the state and in Washington.

In the basement gym of a community center in East Boston, Kennedy cast his candidacy as part of a long-overdue revolution to change government and issued a rallying cry to those disheartened in the Trump era.

“Donald Trump has forced a reckoning in our nation, without question,” Kennedy told the crowd. “But to meet this moment, it requires more than just beating him; it requires taking on a broken structure that allowed him to win in the first place . . . the daily acts of oppression and injustice that enabled 63 million Americans to believe he was the best steward of their dreams and hopes and aspirations.”

Ahead of a rally here, Kennedy emailed supporters a video officially declaring his candidacy and mentioned the need for a new generation to take on “outdated structures and old rules,” an implicit nod to the decades that separate him and his opponent.

Kennedy, who turns 39 next month, is the grandson of Robert Kennedy, who served as attorney general and was a senator representing New York when he was assassinated in 1968 during his bid for the presidency. He is also the great-nephew of President John F. Kennedy and Sen. Edward M. Kennedy.

Family was a strong theme at Kennedy’s announcement, attended by a number of relatives, including his father and twin brother. As he began his announcement, Kennedy’s toddler son, dressed in a light blue striped sailor’s suit decorated with American flags, tugged on his leg.

In his 10-minute speech, Kennedy ticked through his family’s history, beginning with Patrick, who arrived in East Boston in 1848 with empty pockets, and then moving to Patrick’s son, who had the same name as his father and who served as a state senator and commenced the Kennedy dynasty.

Kennedy talked of his desire to defeat Trump and overhaul the Senate’s partisan culture. “I’m running for the U.S. Senate to tear that down,” he said, receiving cheers from the crowd.

While Kennedy is buoyed by his famous last name, he’s also been held up as a rising star in the party, having been picked to deliver the Democrats’ official response to President Trump’s State of the Union address in 2018.

However, some in Massachusetts and the national Democratic Party see his candidacy as damaging. They argue: Why challenge a successful Democrat with nearly identical policy positions at a time when the real focus needs to be on defeating Republicans? Others say Kennedy is the future of the party and a primary challenge will strengthen, not weaken, whoever goes forward.

Markey, 73, has held the Senate seat since 2013 and served in Congress for 37 years before that. He has the backing of Sen. Elizabeth Warren (D-Mass.), who is seeking the Democratic presidential nomination.

Just ahead of Kennedy’s event, Markey challenged him and other candidates in the race to a debate focused on climate change, Markey’s marquee issue, the week of Nov. 11.

“I’m the author of the Green New Deal, along with my good friend Congresswoman Alexandria Ocasio-Cortez,” said Markey, nodding to his work with the 29-year-old liberal favorite from New York.

Environmental activists in particular seemed upset by Kennedy’s decision because Markey has long championed issues they care about and has co-sponsored the Green New Deal, legislation that would address climate change and economic inequality.

“This is the moment for defeating a corrupt and planet-killing president — not for taking down a longtime environmental hero like Edward J. Markey just because you think you can,” Lise Olney, a volunteer grass-roots organizer and climate activist from Wellesley, Mass., said in an email. “Launching an internecine battle to defeat him is the very definition of hubris. And it’s hard to see how it can possibly be good for Massachusetts.”

Attending Kennedy’s announcement, Teresa Aravena of Wakefield, Mass., said she was impressed with Kennedy’s positive comments on immigration that countered all the negativity from Washington on the subject. She doesn’t mind, she said, that Kennedy is challenging someone who has the support of the Democratic establishment.

“I think the Democratic Party has a lot to improve,” said Aravena, adding that she came to the event with her 11-year-old son to show him the importance of politics.

“I think we all need to be more involved,” she said.

Community activists Yamina Lachmi of East Boston and Micaela Younger of Boston said they came to the announcement because they were curious about what Kennedy had to say and feel strongly about immigration, the environment and education. They haven’t made up their minds on who they will support in the race.

“I need him to distinguish himself,” Younger said. “Why would I change my vote if you’re exactly the same?”

Although it’s far too early to predict an outcome, Peter Ubertaccio, a political scientist and dean of the School of Arts and Sciences at Stonehill College in Easton, Mass., said Kennedy is a very serious competitor. “He brings name recognition, money, talent, organization and, at least in the very early polls, a decent lead, so it’s going to be a really hard-fought race,” Ubertaccio said.

While others wondered why Kennedy would challenge a well-liked incumbent, Ubertaccio said it makes sense that Kennedy would want to be in the Senate, at a time when there’s a chance that both the presidency and Senate will turn Democratic.

“If a Democrat wins in 2020, he’s going to want to be playing a leading role in passing Democratic legislation,” Ubertaccio said of Kennedy. “Many members of Congress would prefer to be in the Senate, particularly if their party comes into power.”

But Ubertaccio noted Markey isn’t going to go quietly. As Kennedy has been making noises about challenging him, Markey has been staffing up his campaign and going on the offensive “Massachusetts hasn’t had a primary quite like this since the early 1980s,” Ubertaccio said, citing the 1978 and 1982 gubernatorial races between Michael Dukakis and Edward King, both of whom had served as governor.

In those competitions, there was a clear distinction between the candidates’ policies, Ubertaccio said. But not now. “It really isn’t about significant policy differences,” Ubertaccio said of the Senate race.

Instead of distinguishing himself on policy issues, Ubertaccio said, Kennedy will have to convince Democratic voters in the state that he hasn’t undermined the party by going after an-already Democratic seat.

Scott Gilman, a volunteer with Sunrise Boston, the local chapter of a national environmental group made up of young people, said he’s been very happy with Markey’s leadership on climate change. He said he hasn’t followed Kennedy’s climate stance closely but assumes that his environmental policies will also be liberal.

“I could see myself voting for him in another race,” Gilman said, “but for this race, I don’t see it making sense.”

Gilman said he doesn’t understand why Kennedy would challenge such a strong advocate for the environment. Markey’s “been in this fight since before it was cool. Before Gen Z and millennials were a voting block — since I was in middle school and high school,” Gilman said. “I don’t understand why you would want to challenge that if you’re somebody who’s concerned about climate.”

Mary Olberding, a resident of Belchertown, Mass., and the elected Hampshire District Register of Deeds, said she’s thrilled Kennedy is entering the race. Trump’s 2016 win and the “blue wave” that followed in 2018 showed that the country is ready for new leadership, she said.

Olberding said she’s also focused on the long term. Markey might do a great job for the next six years, but by then, he’ll be in his 80s, and he would be unlikely to run again, she said. Kennedy, on the other hand, has decades of leadership ahead of him — time he can spend throwing support to other Democratic candidates and helping to build the party, Olberding said.

Two other candidates are also in the primary race, labor attorney Shannon Liss-Riordan, a proponent for women’s rights and workers issues, and businessman Steve Pemberton, who grew up in foster care.

Itkowitz reported from Washington.