Drupal core provides and image effect called "Scale and Crop". This effect asks for a target width and height. The source image is scaled up or down to fit within those dimensions (respecting the aspect ratio), and the crops out the remaining portion.

In most cases, it doesn't make sense to upscale the image to fit, because upscaling will result in pixelation and loss of quality.