Hi kerrea,
If you'd like your phone to not play music when you charge, this information might help.
What charging setups is this happening with? For example, is this a charger connected to your car and car speakers? Another possible explanation could be a Shortcut automation that perhaps you set up and forgot about. Check out the Intro to Shortcuts on iPhone and iPad to double-check that.
If the issue continues, let the community know what version of iOS you're currently running. Additionally, let us know if you ever see the If you see an ‘Accessory may not be supported’ alert for your charging setups.
We hope that helps with your question and take care!