delete-by-moving-to-trash is a variable defined in `C source code'.
Its value is

Specifies whether to use the system's trash can.
When non-nil, certain file deletion commands use the function
`move-file-to-trash' instead of deleting files outright.
This includes interactive calls to `delete-file' and
`delete-directory' and the Dired deletion commands.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 23.1 of Emacs.