Two reasons:
One, the difference in behavior between double and single-quoted strings.
"#!/bin/bash\n/usr/local/bin/tor" is "expanded" — that is, the commands within quotes here will be executed first.
Thus,
echo "$(echo foo)" > file puts 'foo' in file, while
echo '$(echo foo)' > file puts
'$(echo foo)' in file.
"#!" is a comment, and this does not occur in other shells. If it begins a file (as a shebang), POSIX specifies that this is undefined behavior; but there's no reason why this should be happening here.