The HTTP 500 (Internal Server Error) status code means that the server encountered an unexpected condition that prevented it from fulfilling the request, according to RFC 9110, the IETF standard that defines HTTP semantics. In the words of Section 15.6.1 of RFC 9110, "The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request."
What the 5xx class means
RFC 9110 says the 5xx (Server Error) class indicates that the server is aware that it has erred or is incapable of performing the requested method, and that these status codes apply to any request method. Its list of classes sums up 5xx as "The server failed to fulfill an apparently valid request", which separates it from the 4xx class, where the request itself contains bad syntax or cannot be fulfilled. The site also explains 400 Bad Request and 404 Not Found, two codes in the 4xx class.
How 500 compares with other 5xx codes
RFC 9110 defines six server error codes, and the IANA registry lists each with the section that defines it.