Which do you think is more ethical: doing something with genuinely good intentions that ends up harming someone or something, or doing something with bad intentions that helps someone?
It’s common for people to do something with the intention of helping, but the results aren’t good.
And it’s also common in the second case for someone to donate millions just to look like a good person.
The classic ethical debate. Essentially the first type is deontology (i.e “acting right”) and hte latter consequentialism (i.e achieving ‘right’ outcomes, regardless of motivation).
Most have moved passed this dichotomy and take up virtue ethics as shown here https://survey2020.philpeople.org/survey/results/4890
As regard your example of people donating ‘to look like a good person’ (i question that this is in anyone’s mind when donating, unless someone else than the wealth-holder enacted it, but i digress) for the virtue ethicist, that donation is ‘right’ if it is in pursuit of some virtue - humility, charity etc..
Personally, i don’t think any of these views works all that well in practice.
Here’s what I wrote on this topic in another post:
I stay away from idealists. They are the most dangerous of the failed demiurges. For them, reality is an unfortunate error that hinders their hallucinations. By “correcting” an imperfect world, they erase the very fabric of existence, replacing the living gap with the flat landscape of their ideas. The more idealists achieve power, the less room there is for the autonomous existence of any individual will.