There is no such thing as an unauthorized MDM. To install MDM, you either
- Must purchase the device from Apple or an authorized reseller and have it added to Apple Business/School Manager and have an MDM connected for automated device enrollment
- Someone must have physical access to your device and must have your passcode/password.
- Someone must have physical access to your device, your iCloud password (assuming you've set that up), and be in a trusted location (or wait for an hour, again, assuming you set iCloud up), then they have to wipe your device and add it to Apple Business/School Manager manually.
Option 1 cannot be removed by you because you don't own the device.
Option 2 can be removed in Settings > General > VPN & Device Management.
Option 3 can also be removed in Settings > General > VPN & Device Management if it has been less than 30 days since the device was enrolled. You would likely notice if this one was the case as again, at a minimum, it requires the device to be wiped.
These are the only options.