Why getMimeType() is returning wrong value for xlsx file
The value returned as MIME type of a file is the value returned from the file.mime_type.guesser service which, on a default Drupal installation, uses three classes to guess the MIME type:


The ExtensionMimeTypeGuesser class (a Drupal core class) guesses it from the file extension, but it doesn't have a mapping for the .xlsx files, for which it returns application/octet-stream (See ExtensionMimeTypeGuesser::guess() and ExtensionMimeTypeGuesser::$defaultMapping.)
The FileBinaryMimeTypeGuesser class (a Symfony class) returns the output of file -b --mime &lt;filename&gt; 2&gt;/dev/null
The FileinfoMimeTypeGuesser class (a Symfony class) returns the output of finfo_file()


It is also possible that a module implements hook_file_mimetype_mapping_alter() to change the value returned from the first class, the file used from file or fileinfo_file() contains the wrong values, or another module implements another guesser class that is used before the other classes and returns the wrong MIME type.