There is no option to send an unattended text message from iPhone without user interaction. This means either someone had physical access to your iPhone or other Apple device (if you do use any) where Text Messaging Forwarding is allowed on it to send that message, or your SIM Card/Carrier account has been compromised.
With other people having access to your iPhone or other Apple device, change the device's passcode and never share with others. If you think your Apple ID could be compromised, change the password and enabled two factor authentication (if it's not already on).
With later option, compromised SIM and/or Carrier account, you would need to contact your Mobile Carrier asap.
Change your Apple ID password
Two-factor authentication for Apple ID
Use a passcode with your iPhone, iPad, or iPod touch