Listening to Michael R. Bloomberg rage about Donald J. Trump in his speech at the Democratic National Convention this week — labeling him a public menace and hinting that he was not quite sane — it would be easy to think that the two billionaires had a rift going back many years.

“Trump says he wants to run the nation like he’s run his business,” Mr. Bloomberg said on Wednesday. “God help us.”

But in all their time in New York City, their interactions have been limited, yet cordial, according to people who know both of them.

They existed in different circles of New York’s ultrarich: Mr. Bloomberg is known as a generous philanthropist; Mr. Trump appears to have been flinty in his giving. Mr. Bloomberg is a supporter of the arts and aligns himself with Manhattan’s sophisticated cultural scene; Mr. Trump relishes in being crude.