FoxDie is an engineered virus that targets a specific genetic code. The code is programmed before the virus is injected into a carrier, and once released the virus halts the heart, so the death reads as a natural cardiac arrest. It is, in effect, a perfect assassination tool.
The Pentagon had it administered to Solid Snake, originally keyed to FOXHOUND members. Naomi, who handled the injection, altered it so that it would also target Snake himself. The complication was genetic: Solid Snake was believed to have received Big Boss's dominant genes, when in fact he received the recessive ones, and Liquid ended up with the dominant set. That inversion is why Liquid was the one killed by the programmed strain.
By the closing chapter of MGS4, the virus had run its course and was killing its carrier. When Big Boss and Solid Snake finally meet, FoxDie recognises Big Boss's genetic code as a target and stops his heart. It is a deliberately symmetrical ending: the weapon built to protect the world ends up killing the man who founded the organisation it was meant to destroy.