Those parts of the key switches could be dead and that means you need a new keyboard... Those keys could be dirty under the keypad and that could make it seem like you are pressing the key, but it won't type... If it is intermittent, it could be related to temperature or humidity causing a problem with the signal produced when you press a key... And again, it could be related to wireless signals if it is a wireless keyboard... And yes, it could even be a malware issue...
If you want more specific ideas, please post more details about the type of keyboard, how long the problem has been present and any other information that might help to diagnosis the issue sight unseen... At this point, I don't even know if you are talking about a keyboard in a laptop, a wireless keyboard or an antique IBM keyboard with an old style keyboard connector... Without details, I can only speculate about possibilities... If you have any other symptoms that might suggest malware, please read the Instructions and post a topic in Malware Removal...