setup:di:compile is related to Magento 2's code compiler. M2 compiles code such as Factories, Interceptors, Proxies etc and puts them in
One of the reasons of code generation is performance so code is readily available for application at run time and doesn't go through process of executing interceptors etc each time a request is made.
When you uninstall a plugin it may have generated code in var/generation directory, setup:di:compile will generate new version of code so uninstalled plugin code is removed.
command is used when you're using more than one independent applications under one Magento 2 code base instance.