May goyim donate money to a yeshiva to fix a gym?
Yes, there is no problem in this. However, the donation should preferably be made discreetly.
Although the Gemara in Bava Basra (10b) writes that it is forbidden to receive money from non-Jews, the Gemara in Sanhedrin (26b) writes that the prohibition applies only to donations given publicly, but not to donations that are given privately, and for which the issues of chilul Hashem (desecration of the Name of Hashem, resulting from the fact that Jews do not support themselves) is not raised. This distinction is ruled by the Rambam (Matnos Aniim 8:9) and the Shulchan Aruch (Yoreh De’ah 254:1-2).
However, the Rambam and the Shulchan Aruch also mention the rationale used by the Gemara in Bava Basra, namely, that accepting charity from non-Jews gives them “credit” that we do not wish them to have. This rationale would seemingly apply even to private donations, a problem for which several authorities suggest answers.
The Derishah (YD 254) writes that the Gemara only forbids accepting charity from non-Jews when the charity is given to a charity collector (gabbai tzedakah), and not when the poor person himself receives the donation. This answer is also found in the Orchos Chaim (vol. 3, 34:1), and is implied by the Meiri (Bava Basra 10a).
The Taz (254:1), however, disputes the solution, suggesting instead that the prohibition applies specifically when the non-Jew desires the special merit of contributing to Jews. A similar approach is taken by Binyan Zion (85). According to these opinions, there would be a seeming problem in the case of the question.
Yet, according to the Maaseh Roke’ach, the prohibition applies only to a large amount that can be shared among many poor people, and according to Shenos Chaim(181d) the prohibition applies only to kings and officers, an opinion also voiced by Rav Elyashiv zt”l (Moriah, Adar 5747). According to this rationale, there is no prohibition in the case presented by the question.
Note that some authorities make a distinction between the laws of charity and the laws of validity for edus (testimony), meaning that the Gemara in Bava Basra (which prohibits receiving charity from non-Jews) relates to the laws of charity, whereas the Gemara in Sanhedrin (which permits receiving charity privately) relates only to remaining a valid witness (see Mekabtziel 23). This will be a cause for stringency.
Yet, in addition to the factors mentioned above, many authorities point out that the prohibition of receiving alms from non-Jews applies specifically to idol-worshippers, and not to contemporary non-Jews who are not idolaters (see Zera Emes 112; Shema Avraham 51; Mayim Chaim 82; Aruch Hashulchan Yoreh De’ah 254; see also Tosafos, Avodah Zarah 2a).
Another important distinction is between charity for the poor and donations to other causes. Concerning donations to a shul, the Gemara writes that it is permitted to receive a donation of a lamp (Erchin 6a). This is ruled by Rambam and Shulchan Aruch (Yoreh De’ah 259:4), and finds an earlier source in the Tosefta (Megillah 2:10). See also Hagaos Ashri (Bava Basra 1:36) who explains the rationale behind the distinction; see also Shach 259:4.
One authority (Avnei Tzedek 14), who was asked concerning approaching non-Jews for a donation towards constructing a shul, concluded his discussion: “leave Israel [to that which they have become accustomed].”
A donation to a Yeshiva is somewhere in between a donation to charity and a donation to a shul. Based on the sources above, there is ample room for leniency, but it should be ensured that the donation is made discreetly.