Ironically enough, it was the opposite. The main reason Mamdani won was because in all the main clips being shared around, he was talking about all the things he would do for NYers. While he mentioned he was against the actions Israel was taking, he was primarily focused on things he could do for NY (regardless of whether he could actually do them or not).
Mamdani's biggest (read: astroturfed) opponent, Cuomo, wasn't any of that. Most of his arguments were basically either "my opponent is a commie who'll wreck everything." Or "We must support Israel, our greatest ally." AFAIK, he didn't say a thing on how he'd change NY policies for making things easier for NYers (and honestly, why would he? He was the one who put them in, in the first place).
Mamdani didn't win BECAUSE he disliked Israel (though that might've helped), he won because he focused on NY in his speeches and shit, rather than focusing on Israel like Cuomo did.