Add to cart button in product page coming from Catalog module with product/view/addtocart.phtml template file.
If you want to customization on addtocart template file in Magento 2, You can override addtocart.phtml file in your module by below way,
Create the catalog_product_view.xml file in your module,
Path: app/code/{VendorName}/{PackageName}/view/frontend/layout/catalog_product_view.xml
<?xml version="1.0"?>
<!--
/**
* @author Rakesh Jesadiya
* @package VendorName_PackageName
*/
-->
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.addtocart">
<action method="setTemplate">
<argument name="template" xsi:type="string">VendorName_PackageName::product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate">
<argument name="template" xsi:type="string">VendorName_PackageName::product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
product.info.addtocart and product.info.addtocart.additional block contains the addtocart template file.
Now you have to create template file addtocart.phtml in your module at below location,
app/code/{VendorName}/{PackageName}/view/frontend/templates/product/view/addtocart.phtml
copy the clone of template from Core Catalog module’s addtocart.phtml file and do your customization.
