During a tense time for public officials, Zohran Mamdani, the Democratic mayoral nominee in New York City, received messages calling him a terrorist and telling him he was unwelcome in the U.S.