When you install a package and APT needs to install one or more additional packages that you didn't explicitly request because they are dependencies, APT keeps a record that these were "automatically installed" - ie, that they were not explicitly requested.
The only reason it remembers this, is so that it knows it can automatically remove these additional packages when all the packages that depended on them are also removed.
Using apt-get, this is done by either
apt-get remove <mainpackage>
apt-get autoremove
Or, you can tell apt-get to do the autoremove at the same time:
apt-get autoremove <mainpackage>
Note: other APT front-ends such as aptitude can also take advantage of this.
The auto-remove statement tells APT to remove any packages that were marked as automatically installed, and no longer have installed packages depending on them.
In almost all cases, this operation is safe, because they will most likely be packages you never interacted with directly; only via the other package that depended on them.
The only scenario where this may cause a problem is when a package is initially installed automatically without being explicitly requested, but later you begin to start using that package directly. When you do an autoremove after removing the original package that depended on it, you find that this new package you started using is also gone because it was originally marked as automatically installed.
This operation is pretty easy to reverse and is not usually a large problem, and it's a rare scenario. With apt-get, you can ensure an installed package is never automatically removed by explicitly requesting its installation with
apt-get install <package>
If that package is already installed, it will remain installed and merely have its "automatically installed" status removed.
sudo apt-get autoremove
.