My iPhone XS Max passcode changed?

I was out walking, took my iphone out my jacket pocket and it was disabled for 5 minutes. I didn't think much of it, I thought maybe I was accidentally pressing it in my pocket. Then after 5 minutes was up I typed my passcode in and it didn't work the phone was then disabled for 15 minutes?
I definitely didn't forget my passcode or change it as I've used the same for years. I've owned iPhones for over 5 years and this has never happened to me before. Is it a bug or has my iPhone possibly been hacked?

Impossible unless it went into settings-touch ID and passcode, put in the correct passcode, selected change passcode and put in the exact same 'new' passcode number. Twice. While it was in your pocket. Highly improbable.

Make sure you can sign into appleid.apple.com using your AppleID email and password. If you can't contact Apple. It is impossible to remotely change the passcode on the iPhone but it can be put into lost mode. If you can't get into your phone you WILL have to put it into recovery mode using iTunes on an actual computer which will restore it. That is why you need to make sure you can get into your appleid.