There might be an autorun.inf file which is creating such an issue for you.
Follow all the steps given below
1) Disable the "Autoplay" feature. Click on the below link "Disable Autoplay",
and download the file --> Double-click on it and follow the instructions.
2) Disable the "Autorun.inf". Click on the below link and follow the instructions.
First backup your registry. Click on Start --> Run --> Type regedt32 and press
Enter. "Registry Editor" will be opened.
Now backup your registry by going to "File --> Export" --> Save the file with
any name in your desired location.
Copy the text starting from "REGEDIT4" upto @="@SYS:DoesNotExist"
Open a "Notepad" --> Paste it --> Save the file as fix.reg
Note: Don't forget the extension "reg"
Now double-click on the fix.reg file and then click on "Yes" to merge it,
[Note : After following the above instructions, whenever you place any autoplay
CD\DVD all you have to do is go to "My Computer" --> Open the CD\DVD drive
--> You have to double-click on the setup file.]
3) Click on the below link and download the file "AutorunExterminator"
Extract it --> Double-click on "AutorunExterminator".
This will remove the autorun.inf files from drives.
[Note : AutorunExterminator need Dot Net Framework. If its not installed in
your PC then click on the below hyperlink ".NET Framework" and download it
4) Click on the below link and download the file "USBFix".
Open the USBFix --> Click on "Deletion" and follow the onscreen instructions.
After completion of "Deletion" process, click on "Vaccinate".
5) Click on the below hyperlink "Malwarebytes Anti-Malware Free" and
Malwarebytes Anti-Malware Free
Update it --> Perform "Full Scan".
Make sure you connect your pen drive also.