How is Microsoft getting viruses?

I really don't know what's wrong with Microsoft. It has been revealed that Microsoft is the largest software company but it has not been able to be like Linux to avoid viruses. On the other hand, I have tried some Microsoft games and they lag like nothing else. If that's the case, I will give up using Microsoft's everything and shift to Linux. Am I leaving Microsoft? Please provide logic to support your answers.
