MANASSAS, Va.—Corey Stewart had visited the Dar Al-Noor mosque many times as chairman of the Prince William Board of County Supervisors, but never as the leader of Donald Trump’s presidential campaign in Virginia.

“As-salamu alaykum,” he said Monday morning, greeting hundreds of Muslims on the holiday of Eid al-Adha, marking the end of the yearly pilgrimage to Mecca. “This is kind of an awkward position that I’m in.”

He...