Sounds Like A Flood Car
Many flood cars that just got the interior fabric and carpeting wet, but nothing wrong with the electrical system, successfully avoid declaring the damage when selling the car, And CarFax usually misses all but insurance claimed cars.
I agree with the suggestion to use ozone, but you may have to remove the seats, too.
Initially, pump ozone into the vehicle for at least 4-5 hours. Using a blower to circulate the ozone will also help. It won't do any damage to wiring or other surfaces or interior plastics, but it will treat the mildew.
If the odor remains after 5 hours, remove the seats and wrap them in plastic (big garbage bags will do) and run the ozone through a hose into the bags for several hours. That will expose the entire outside surface of the seating, including the underneath sections.
Give the interior carpeting the "sniff test". If the odor is still in the carpeting, ozone it again overnight. The morning after that, run the ozone for a few hours while the engine is on, and the air conditioner is on high - max cool. Then use a Farbreze-like product; there are many... including some from detail chemical suppliers; it's all the same stuff.
Flood cars that do not respond to the above usually require new interior carpeting, and possibly seats.
The repair is costly, which is why so many cars that are caught in high water situations are sold without reporting the problem. Once you go to your insurance company, the cost of repairs will likely boost your rates.
Good luck. Please don't shoot the messenger!
-Steve