He knows your Passcode/Password, whether you know he does or not. There is no hacking going on, it can be done just by logging into your account online with that information.
Set a passcode on iPhone - Apple Support
Change your Apple Account password - Apple Support
Run Safety Check and you can do many of these checks:
- Change Apple ID Password
- Change Passcode
- Review other devices logged into your account
- Review information you are sharing to others
- Review Trusted Phone numbers on your account
- Review apps that are accessing your location
How Safety Check on iPhone works to keep you safe - Apple Support
If these are your concerns, you may want to consider a title for this person other than "boyfriend".