Same issue on 2020 Mazda CX-30 (previously connected to an iPhone 11). I recently upgraded to an iPhone 15 and bought a USB-C to USB 'original' adapter and a generic cord to use in the car, both off of Amazon. I know the cord worked, at least for charging my iPhone 15 in my house. And Mazda's Apple Car Play recognized the iPhone 15 and paired with it via Bluetooth, as I could play my music through the Mazda's entertainment system.
But the iPhone 15 kept connecting and disconnecting to Car Play via the wired connection.
Spoke to a guy at Mazda's service department in Tacoma. He was helpful, but couldn't really sort it out remotely. Hypothesized it might be the cord...or the adapter. So I brought the original cord I got with the iPhone down to the Mazda, plugged it in via the generic adapter and Viola...it was good times once again.
I have no idea what the difference is between Apple's OEM cord and the one I got from Amazon, but it's not a problem as I just need to charge my phone in the house (and either cord does that). But only the Apple OEM cord will let me iPhone 15 drive the Mazda navigation system via Apple Car Play.