Hi
Some program seems to be interrupting the process,
You could try performing a Clean Boot, then try automate disk cleanup.
Specific steps check out: https://www.windowscentral.com/how-automate-disk-cleanup-tool-windows-10
If it remains hanging, you might need to look into Process Monitor for the exact cause:
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
I hope this information above can help you.