AD's will popup on screen Each time when i turn on my WiFi, ads will popup and apps will get installed automatically. Some times WiFi switch's on automatically and junk apps gets downloaded.
It would appear you have some sort of malware. I'd consider one of three options:


Antivirus - May get rid of the virus without harming your legit files.
Fresh reinstall of the stock ROM - WILL get rid of any viruses...along with anything else you had on your phone. It WILL NOT fix any malware-esque behaviours that were built into the rom
Install a custom ROM - Like 2), will get rid of any viruses and the popular custom ROMs, for example Cyanogenmod, do not have any malware-esque behaviours. This option requires you to root your device and unlock the bootloader. Googling 'install cyanogenmod ' should tell you what you need to know.


I would try the solutions in that order to save on unnecessary lost data or technical ordeals.