It is most likely not a virus. The Iphones touchscreen measures the change in current caused by your fingers to figure out where you are touching. If the iphone is plugged into a faulty charger there may be other sources of current change that misleads or confuses the touchscreen, and produces the symptoms listed above.
it just so happens that most non-apple chargers are made to cost less, thereby forefitting quality, and that may be the reason most people find switching to an apple charger fixes their problem.
i have not tested this, but i assume charging an iphone with a quality usb-wall-charger designed for other modern touch screen phones will solve the problem and may be cheaper than buying an apple charger.
aditionally it would actually take more effort to design a virus that stole your stuff by pressing the buttons, than if it were to just run behind the scenes and steal your stuff. so it is most likely an electrical issue that wont be fixed by any software letalone an antivirus.