https://www.cdc.gov/hiv/data-research/facts-stats/gay-bisexual-men.html
https://www.healthline.com/health/hiv-aids/hiv-risk-in-gay-men#transmission
https://en.m.wikipedia.org/wiki/HIV_and_men_who_have_sex_with_men
https://www.unaids.org/sites/default/files/media_asset/2019-UNAIDS-data_en.pdf
https://pmc.ncbi.nlm.nih.gov/articles/PMC10159196/#pone.0281578.ref001
Consensus is that MSM are somewhere between 20-26 times more likely to contract HIV then other adult men. How much of that is biological and how much is cultural (e.g. in countries where homosexual sex is criminalized, access to healthcare and prophylactic medicines are likely less available) is definitely up for debate, and it of course does not mean that a straight man cannot contract HIV.
As I said, kinda dumb. There's likely some homophobia that went into the decision.
From a purely economic view, though, there might be some justification? If the blood is batch tested, e.g. 10 samples are mixed and tested, excluding a group more likely to have a disease would mean you'd throw out less blood (or have less testing to do if you then test individual samples). I don't know enough about blood donation testing to say if that's a valid argument or not, though.