Indeed, Mr. Gaetz — known as Baby Gaetz in Tallahassee to differentiate him from his more powerful father — made his reputation back home as a serious, if combative, legislator who played an instrumental role helping Mr. Scott, then the governor, kill efforts to expand Medicaid under the Affordable Care Act.

He also joined with Democratic lawmakers to push marijuana legalization, and he persuaded his father in 2015 to join Democrats to pass a law that removed Florida’s ban on adoptions by same-sex couples. He initially supported Jeb Bush, the former Florida governor, for president in 2016 before jumping over to Mr. Trump. His father was a Bush supporter, and his younger sister worked on the Bush campaign as a video producer.

Mr. Gaetz is also a passionate champion of animal rights. On the day of the Cohen tweet, he sent text messages to offer condolences to Mr. Schale after his dog died. When he served in the Florida House, he pushed to end greyhound racing.

“Matt has played both the hero and the villain,” said Ryan Wiggins, a Republican political consultant who worked on his first congressional campaign. “I suspect he probably enjoys the reactions he gets when he makes people’s heads explode on the national stage.”

With a promontory chin and crooked grin, Mr. Gaetz cultivates an air of genial menace, like a netherworld Jay Leno. His email handle in college was Gaetzofhell, a classmate recalled.

His transition to Washington was bumpy. In early 2017, at a lunch for the incoming freshman class at the Capitol, he complained to table mates about how tough it was to be a backbencher and railed, in four-letter fashion, against the House Freedom Caucus — now his allies — for being “a bunch of obstructionists,” according to a person sitting nearby.

“I would end my days exhausted,” Mr. Gaetz recalled. “I was unable to rationalize what I had done to make progress. If you can’t impact an outcome in this town you are an extra in the movie, and I do not want to do that.”