GrubHub Inc.’s chief executive sought to clarify postelection remarks in which he seemingly suggested employees who back Donald Trump’s politics resign, highlighting the dangers executives face when delving into political and social issues.

CEO Matt Maloney is among several technology executives, including the chiefs of Apple Inc. and Amazon.com Inc., who reacted in the wake of Mr. Trump’s victory. The Chicago food-delivery company’s chief sent a companywide email denouncing the “nationalist, anti-immigrant and hateful politics...