It allows for file transfers via drag and drop - pretty sure it uses iCloud as the data cache inbetween.
iCloud is used for two reasons: one, because it is existing infrastructure for sharing secret keys between Apple devices used by a single owner (and is thus "free" from a development standpoint for Apple), as well as the fact that more iCloud-only features tends users into opting in to iCloud, which eventually drives increased Apple services revenue via expanded paid service usage as well as lock-in to keep users using those paid services over time.
The HomePods work this way, too. You can't just connect them to Wi-Fi and use them via AirPlay 2, you must have an iCloud account to attach them to your LAN.