The only way to have malware is by hacking/jailbreaking the iPhone. Unless you hacked the iPhone, you don't have malware or a virus primarily because there are none wiuth a non-hacked/jailbroken iPhone.
if I buy a new car that doesnt work do I expect to get back a used one that smells like cigarettes when i dont smoke?
No, and you won't receive an iPhone exchange under warranty that smells like cigarettes or anything else.
An exchange under warranty will be a new or refurbished iPhone with no way to tell the difference. A refurbished iPhone includes a new battery and casing and remains under the same warranty as the original purchase. If an iPhone is exchanged under warranty within 90 days of the warranty expiration date, the exchange includes a 90 day warranty.
The iPhone you have is no longer new. It is used.
If covered under warranty and you want it repaired, send it in.