You can see which action controller is initially called by the url, that is always build up by: module/controller/action
i.e. when adding a product to the cart the url is: checkout/cart/add
So the controller you have to look at is at app/code/core/Mage/Checkout/controllers/CartController.php In there it's the addAction method.