Every file in a computer is not identified just by its extension. It has certain leading bytes called "file signatures" and "hidden" data called metadata. Which determines the file type.
a) File signatures:
File signatures (also known as File Magic Numbers) are bytes within a file used to identify the format of the file. Generally they’re 2-4 bytes long, found at the beginning of a file.
https://www.garykessler.net/library/file_sigs.html - garykessler signature repository helps in finding file type by using hexadecimal editors like xxd, hexdump. Here, from output look for FF D8 which determines as jpg file from garykessler website.
$ xxd file_name.jpg | head
Also, Linux utility "file" command can easily determine file type.
***