Lately I have been seeing the terms sub-domain and sub-directory being used interchangeably in the context of hosting, but even though the former can point to the latter, they are not the same. A sub-directory is a file storage location/association in the hierarchy of the file system. A sub-domain is an address locator, which in many cases points to a sub-directory.
For example, instead of accessing example.com/sub-directory-x/sub-directory-y/sub-directory-z/index-xyz.html, you can create a sub-domain to point to sub-directory-z. Then you can simply navigate to sub-domain-z.example.com/index-xyz.html. But this is an oversimplification!