xargs -d "\n" -I {} rm \"{}\"
This assumes GNU coreutils' version of xargs that supports the -d option for specifying the delimiter.
This will not work together with your find command because it adds double quotes to the pathnames found by find. This means that instead of ./somedir/file.scala, the call to rm is done with the literal pathname "./somedir/file.scala".
Example:
$ touch hello
$ touch '"hello"'
$ ls
"hello" hello
$ echo hello | xargs -d "\n" -I {} rm \"{}\"
$ ls
hello
It works when you pipe the generated commands to bash because bash does quote removal.
It would probably also have worked if you didn't go through the extra effort to add the quotes in the first place:
xargs -d "\n" -I {} rm {}
To delete your files properly, use
find . -type f -name '*.scala' -delete
or, if you still want to use xargs:
find . -type f -name '*.scala' -print0 | xargs -0 rm
which passes the pathnames between find and xargs as a nul-delimited list. Nul (\0) is the only character that is not allowed in a pathname on Unix systems. Filenames can additionally not contain /, but newlines are allowed.
A third option would be to call rm directly from find:
find . -type f -name '*.scala' -exec rm {} +
Note that {} does not need to be (and should not be) quoted as find knows perfectly well how to pass pathnames with spaces (or newlines or whatever it may be) to the named utility.
findusefind ... -deleteinstead. Piping tormmakes no sense