Your iPhone is not hacked. Your ex could have your Password if it was given to him. There is no need to create a new Apple ID, you can change the Password here:
Change your Apple ID password - Apple Support
If you have another email address that you want to use for your Apple ID, you can change your Apple ID too:
Change your Apple ID - Apple Support
You will also want to make sure that there are not Trusted Phone numbers listed that are not yours at Settings > [name on top] > Password & Security > Trusted Phone Number
Also review the Trusted Devices by going to Settings > [name on top], and scroll down to the bottom to view other devices that are linked to your Apple ID. You can tap on them and remove them if they are not yours.
You should not be part of a Family Sharing plan. This can be checked at Settings > [name on top] > Family Sharing. If it has not been set up it will show a Welcome screen that you can cancel. If it is set up, it will list the people in the Family Sharing plan. If you see his name there, reply back with further instructions. If you are the Organizer you can remove him there or leave the Family Sharing group.
Leave Family Sharing - Apple Support
For more information if you think your Apple ID has been compromised:
If you think your Apple ID has been compromised - Apple Support