When you do something ethically, you do it in an honest and principled way. Investing your money ethically requires you to carefully consider the way it will be used, and whether it will cause any harm.
If a coffee grower pledges to act ethically, it means they promise to pay farmers fairly, and cosmetic companies run their businesses ethically when they use sustainable ingredients and refuse to test their products on animals. In both examples, there is thought given not just to making money, but to the way workers, animals, and the planet might be affected. The adverb ethically has a Greek root, ethos, "moral character."