A help center article explains that Gmail "shows you a warning above any message that looks like a phishing scam but comes from an address in your Gmail contacts list. When a suspicious message like this is sent from an email address of someone on your contact list, it's possible that the person's email account was compromised and used without their permission to send a malicious message."
Google advises you to "read the message and decide if it seems like it was written by the sender. Consider whether it sounds like the person you know, contains suspicious links or content, or asks you to do unusual things like send money or provide personal details. If it seems like your contact's email account was compromised and used to send this message, please click Report this suspicious message within the warning. The message will be marked as 'sent from a compromised account,' and you'll send a report to the Gmail team to help us improve our detection of compromised accounts."
You may be wondering why Gmail doesn't flag the message as spam. Messages from your contacts are never moved to spam. In fact, that's one way to make sure that you receive messages from someone and they're not added to the spam folder: add the email address to your contacts.
I checked to see if the messages was sent by one of my contacts and the answer is no. That's strange, maybe this is a Gmail bug.