I come across a file in /usr/bin or /etc and wonder where it came from. dpkg keeps that record.
dpkg -S /usr/bin/dig
dpkg -S $(which crontab)
dpkg -S (search) prints the installed package that owns the path, in the form package: /path. It only knows about packages that are installed, so use apt-file for the others. If it finds nothing, the file was created by a script, built from source or installed by another tool. Give the full path as the system lists it, because the search compares file names as dpkg recorded them.
Further reading: dpkg manual page