If you told us what antivirus app it is we could give better advice. I've never heard of a legitimate app giving warnings about erasing the phone, so don't know what to make of that.
Can you not just uninstall from the system settings? Settings > Apps, select the app, select "clear data" (which clears data for the app, not the whole phone) and "uninstall". That should just remove the app and do nothing else.
Some security apps will set themselves up as device administrators, in which case you'll need to undo that before you can uninstall them (should be in Settings > Security). A decent security app will have instructions for uninstalling, including this step if needed.