Insert post’s category name into thumbnail string

As @belinus mentioned, you can assign multiple categories to a post, so you have to decide which one to pass to the_post_thumbnail().

One approach would be to use get_the_category(), which returns an array, then grabbing the first result from that function as your thumbnail size:

$categories    = get_the_category();
$thumbnail_cat = ! empty( $categories[0]->slug ) ? $categories[0]->slug : '';

the_post_thumbnail( $thumbnail_cat );