WASHINGTON—Dining at his oceanside resort in Florida on Friday, President Donald Trump was surprised to learn that national security adviser Mike Flynn was sitting at a nearby table, a person familiar with the event said.

“What is he doing here?” the president said, describing the man who was once at the center of his political orbit as “very controversial.”

The...