Its not the problem inside your phone or your software. Its something that webscripts are responsible for. Many webpages create automatic redirecting ad popups.
There are two ways to deal with this->
To use AdBlock Plus or similar like MANIMANI said. Though on personal note, I haven't really been able to get any such AdBlocking apps to work properly on Android. But again, that could be just me doing something wrong perhaps.
Change your DNS. You can use alternative Domain Name Server such as Open DNS or Google DNS or any other alternative you prefer. This works by changing your lookup for an ad-server which points to your local machine, hence basically preventing them to do anything to your PC. Additionally, many DNS servers are configured to block access to domains or hostnames which are responsible for such ads.
By the way, here's Google DNS and Open DNS in case you want to use:
Google DNS
DNS 1 – 8.8.8.8
DNS 2 – 8.8.4.4
OpenDNS
DNS 1 – 208.67.222.222
DNS 2 – 208.67.220.220
Also, you do not need to worry about malware. Malware wont affect your android device unless you manually install a malware infected app :)