In the age of data-driven, targeted advertising, spending so much on a single ad to reach such a broad audience may seem wasteful. But Howard Wolfson, a top adviser to Mr. Bloomberg, said the thought behind buying an ad during the Super Bowl was simple: It will reach the largest available audience, and Super Bowl ads are often talked about well after the game.

“It’s a time when people get together and they sit down and they watch the Super Bowl, but they also know that there are these ads and there’s a lot of conversation about the ads,” Mr. Wolfson said. “It’s a very wide net, it’s a broad swath of Americans, and this is an issue that there’s been an awful lot of agreement on.”

The campaign said it had selected an ad about gun violence for the Super Bowl slot because it was an issue “central to Mike Bloomberg.” Indeed, Mr. Bloomberg, the former mayor of New York, made the final call. When shown a variety of ads to choose from, Mr. Bloomberg was “adamant” that the campaign run the one featuring Ms. Kemp.

“I cried the first time I saw it,” Mr. Wolfson said. “Other people who saw it in the office cried. There are a lot of fairly hard-bitten political people here.”

Mr. Trump’s ad begins with a news report from Mr. Trump’s favorite night — election night 2016 — as a narrator intones that “America demanded change, and change is what we got.”

Quick flashes of military operations — an aircraft carrier cutting through choppy seas, a fighter jet making a hard banking turn — give way to a recited list of economic realities under Mr. Trump: rising wages and low unemployment.

At the end of the ad, Mr. Trump is shown speaking at one of his raucous rallies, proclaiming, “Ladies and gentlemen, the best is yet to come.”