check why iPhone restarted
Solution 1:
I had the problem of my iPhone 6s randomly restarting. It might not be the same problem you're having, but it will give you something to check.
For me, the restarting problem occurred several times in the months leading up to the phone dying. Well, let me be more specific: about a month after experiencing the random restarting problem, I began to notice the phone wasn't holding a charge. So I called Apple support and they had me check Settings-->Battery-->Battery Health.
In that section it showed I had "Maximum Capacity 87%" but then below that in the "Peak Performance Capability" section it had a message indicating there had been a problem (I can't remember, but the message was something like performance monitoring had been turned off because the battery couldn't supply enough power).
After that I took the phone in to an Apple service center to get the battery replaced, but was told that it wasn't that easy: there was a problem with the power supply which meant a hefty repair. That's when I changed phones.
So, I'd check the above settings, keep an eye on your battery performance, and perhaps call Apple if things go downhill.