Which function crops images in wordpress?

The image goes through multiple processes for the thumbnail to be generated. Take a look into the WP_Image_Editor class in the wp-includes/class-wp-image-editor.php.

This class handles cropping, resizing, etc.

There is a public function inside this class, named crop(). This might be what you are after. However, the actual resizing is handled by the function multi_resize(), which generates thumbnails for each uploaded image.