You invest $100, now you have $110. You give away $10, you have $100 again.
> Then your net worth is $110 and when you give away $10 your net worth goes down $10.
Gates' wealth fluctuates all the time. There was a time when he was rather low due to his donations - multiple 10s of billions down. He got back over $100B from cca $50B - that's $50B more for charity than if he just donated everything he had left.