Custom themes are located in the app/design/frontend directory. Lets say a theme with name Anees_Mytheme.
The parent theme is defined in parent node in theme.xml.
To find out the phtml path of file on any page run the command bin/magento dev:template-hints:enable
If you want to modifying a template from the Magento_Catalog which is often located under vendor folder.Now create a Magento_Catalog folder inside your theme directory and copy it there under template or layout folder.
theme.xml and registration.php are the only two required files.Overriding existing Magento or 3rd-party module template files is as simple as replicating the directory structure in your theme.