I think the web may be redirecting you, which generates the error. if you use the -L flag “follow redirects” it should work.
#!/bin/bash
echo "Downloading Visual Studio Code..."
curl -L -o VScode.zip https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal