Any symptoms besides fever? Fatigue, sweating, nausea...?
Flu does not likely come with fever and no other symptoms. The opposite: sore throat, fatigue and no or low fever would be more likely.
Cold vs flu chart.
Being severely dehydrated and being in the hot environment can cause heat exhaustion (tiredness and rise of temperature toward 40 C).
I've not heard so far that anxiety alone could result in 40 C.
Viral pneumonia, hyperthyroidism, pheochromocytoma, fish/shellfish poisoning...these are some random causes of hyperthermia.