Can I remove a virus by flashing my android?
All this behaviour can occur if the application you used to root your phone installs some kind of malware or you get a malware at a later point. You cannot remove this by a factory reset as it does not remove root or system apps and does not rewrite the system partition. Your only rescue here is to download SP Flash Tool and flash your system image, as flashing a system image rewrites your system partition and will remove every unwanted app, but you will lose root. If you want to root it again use SuperSU with TWRP. It will not install any malware and your problem will get resolved.