WiFi devices use the Internet Protocol and can communicate with online services and apps over normal computer networks.
Zigbee, Zwave, etc use a completely different protocol that can't interact with the Internet directly. These protocols are optimized for low power use and for interacting with other home automation devices over their own short range wireless channels.
These devices can technically communicate with each other directly, without a hub, but then you must use a remote control device. For example, there are ways to pair certain Zigbee switches to directly control a Zigbee lightbulb.
The hub is used to bridge the HA wireless protocol with the Internet Protocol. This way your phone (which doesn't have a Zigbee/Zwave radio) can connect to the hub and control everything.