I really struggle to understand your confusion. How do you think normal companies work?
Ecosia is profitable, they take some percentage of that profit and use to plant trees. In a "normal" company that money goes straight into the pockets of the company owners. Profit is measured after investments into R&D, salary, marketing everything that come with running a business.
Sure they could "just" spend more on developing their product, but from what I can see they don't really need to, it's already a good product. So rather than stuffing the pockets of an owner or shareholders, they donate that profit, or parts of it, to organisations that plants trees. Most people wouldn't donate to a tree planting organisation, but they will switch their search engine, if it's good enough and even if that plant only 100 trees, that's better than no trees.
I worked for a company that spends it's profit on helping sick children. The owners make enough money. They donate over €1.000.000 per year to a foundation, rather than putting that money into the pocket of the owners. The customers might not even know that they support that foundation, but that also doesn't matter as long as they get the products they want and the price they want. Your suggestion is that the owners should pocket that cash, and I should go donate to that foundation directly?