Optifine is not a virus. It is arguably the most popular Minecraft mod and safe for use, referred to and preferred by new and old Minecraft gamers. But make sure you download Optifine from the official website to avoid viruses. You may come across multiple duplicate sites offering Optifine download versions. Always download Optifine from here - https://optifine.net/home to avoid installing viruses or other malware.