We call the Rest API with "/rest/V1/carts/mine".
Where is the code located in magento?
You need to search the api definition
<route url="/V1/carts/mine" method="GET">
<service class="Magento\Quote\Api\CartManagementInterface" method="getCartForCustomer"/>
<resources>
<resource ref="self" />
</resources>
<data>
<parameter name="customerId" force="true">%customer_id%</parameter>
</data>
</route>
The interface is provided there.
Then you need to search the class implementing the interface, or to go faster directly the method name
This is how you end up finding
src/vendor/magento/module-quote/Model/QuoteManagement.php
/**
* @inheritdoc
*/
public function getCartForCustomer($customerId)
{
return $this->quoteRepository->getActiveForCustomer($customerId);
}