Starting from Ubuntu 21.10 Impish Indri you will get the trash can icon on Ubuntu dock panel. Ubuntu moved trash can from Desktop to Dock. If you are not a fan of this move and want to completely remove the trash can from Ubuntu dock, then follow below tips to remove or hide it from dock.
Remove Ubuntu Trash Icon From Ubuntu Dock
Ubuntu 22.04 & Later
In Ubuntu 22.04 you can easily hide and show the trash can using the Settings app. Open the Settings and select Appearance. Now scroll down to the Dock section and click the Configure dock behavior and toggle the Show Trash button to hide and show the trash icon from the Ubuntu dock.
Ubuntu 21.10 & Older
Open your terminal command-line tool (ctrl+alt+t) and run below command to remove it instantly.
gsettings set org.gnome.shell.extensions.dash-to-dock show-trash false
Show Ubuntu Trash Icon in Ubuntu Dock
If you changed your mind and want to show trash icon on your Ubuntu dock panel, then in terminal run below command.
gsettings reset org.gnome.shell.extensions.dash-to-dock show-trash
That’s it.