iPhone 15 Pro Max suddenly frozen and automatically restarts

Today I was connected to my co-worker's stereo system in his car as I usually do when we come back from work and we go to a restaurant I was scrolling my phone and when I reached Apple Music, the phone suddenly froze and automatically shut down and restarts after a while and froze again and the cycle continues. After we came back from the restaurant, I connected my phone to his stereo system again and this time the problem solved itself. I disconnected my phone from the car stereo Bluetooth list and vowed never to connect my phone again there. So far no problem until my phone restarts automatically just now for no reason. Is this a common problem with iPhones? This is my first iPhone after years of using Android and I have experienced something like this on my previous phone which is One Plus 8 Pro. I love my new iPhone and experiencing this problem is worrying me.