Usually files with the extension
.def collect long lists of similar definitions, that would make a
.sty file long and unreadable, or that can possibly be shared with other packages.
tex packagename.ins creates a
.def file, then this is part of the package structure and mustn't be omitted.
A typical example are the
<encoding>enc.def files, such as
t1enc.def loaded by
Standard LaTeX file]
where having the long list in a separate file makes it more easily maintainable and searchable. Similarly
.def files for lists of pairings between input characters and their connected output.
Some other packages use some
.def files for "context dependent" code. Examples are
hyperref that put the engine dependent code (for
.def files such as
Other packages, notably
.def files to load code depending on what packages are loaded in the document.
In some cases perhaps an extension such as
.sto ("style option", modelled after
.clo used by the standard classes) might have been preferable, but tradition has its influence. So long as the names are unique, the extension used is irrelevant.