1. You want to acquire the existing users of their software.
2. Buying them essentially stops progress on your competition. Let's say you don't buy them and instead decide to write your own software that does what theirs does. Maybe it takes you a year to write a program that does everything theirs does today. In that year, they've also made a bunch of progress, so you're still behind. If you have enough resources, you may be able to catch up and overtake, but they have the advantages of greater expertise, userbase, and lead time. Because of those advantages, it's often cheaper to buy them.
In general, companies don't like to compete. Competition is spending resources to simply cancel out the expenditure of your competitor. Zero-sum games like that don't make you richer. Companies naturally prefer to be monopolies, or at the very least cabals. That way they can fully exploit their product area and can control prices as much as they want.
* Very large tech companies build software (relatively) slowly due to their size
* Sort of like a toddler, you don't know what you want until you see that someone else has it. Another company hitting product/market fit + traction proves the value of a product that you might have just hypothetically wanted
* You're often buying a go-to-market motion (marketing, sales, services, etc) that complements a product
* In some cases, you're buying talent that would be difficult to hire + train on your own _fast_. Ie even if you could theoretically hire 50 traffic mapping engineers, you can get them onboarded onto your team faster by acquiring Waze
Also, userbase and customers are valuable.