Gates is worth about $100B, Elon Musk about $850B. Let's call it $1T altogether. That would be at most about $115 per human on Earth (~8.5B humans). Not sure that is sufficient to "end hunger and homelessness."
It’s not like giving that money to people is the only option. you can spend it in projects that produce food, build low cost houses, etc.
let's set aside for a second the fact that this is not how things work, but you are off by an order of magnitude
EDIT: parent comment was edited: it used to say $15
That not even enough for DoorDash in Seattle.
Your calculation only makes sense if every one of those 8.5B humans is suffering from hunger and homelessness. Somewhere around 1 in 1000 people are homeless (https://worldmetrics.org/global-homelessness-statistics/), and 1 in 12 or so has experienced "hunger" some time in the past year (https://www.fao.org/hunger/en/). Obviously the numbers depend on how you define "homelessness" and "hunger", but in any case this multiplies the $ that could be used to help individuals by those factors. Between $1000 (hunger) and $115,000 (homelessness) may not sound like a lot, but when your yearly income is around $1000, it can mean a lot.