Why does my galaxy S3 phone turn off and then on I don't understand is this mean it has a virus or no


If you think it has a virus there are several vendors that have phone anti-virus programs. I use AVG.

You can also do a reset to factory defaults after you back up your data.

Past that, it may be a hardware issue, battery or maybe the actual board and chips.