How do I stop my iPhone 6S from automatically playing music when I have it charging?

I got a USB cord to plug into the port in our car since our car charger broke. Well Apple CarPlay appeared and connected my phone to the car speakers while I was using Spotify. I tried making CarPlay forget the car in settings, didn't work. Next I tried removing it from the list in the CarPlay settings in our car, also didn't work. I tried turning off CarPlay completely in the car and it still didn't work. I know that my phone is still connected because besides playing the music through the speakers, the blue bar at the top is on showing it's connected.

I don't know how to turn it off without unplugging the phone. I don't particularly want my music playing while others are in the car. Is there any other way to stop my phone from playing music over the car speakers, or am I just gonna have to get a normal car charger instead of using a USB cord to charge my phone?

Take a sledgehammer and punish it. It won't do it again, it will promise you.

Turn down the volume to the speakers?

Turn off (exit from) the app.