See this article https://support.apple.com/en-in/guide/mac-help/mchlp1093/mac
Delete an item from your Mac or iCloud Drive
- On your Mac, drag the item to the Trash in the Dock or select the item, then press Command-Delete. If an item is locked, click Continue to confirm you want to move the locked item to the Trash.
If an item is locked, you need to confirm you want to move it to the Trash, or unlock the item before putting it in the Trash. To unlock the item first, select it, choose File > Get Info (or press Command-I), then deselect the Locked tickbox. If you are not logged in as an administrator, you may need to click the lock icon , then enter an administrator name and password.
Make sure you have turned on iCloud Drive see this article https://support.apple.com/en-in/HT204025
And in front of options the desktops and documents box is checked see this article https://support.apple.com/en-us/HT206985
https://support.apple.com/kb/PH27917?locale=en_US&viewlocale=en_US
https://support.apple.com/kb/PH27915?locale=en_US&viewlocale=en_US