Mildew loves a damp and warm habitat. This means that the insole of your shoe is a perfect place for mildew, and the accompanying bad odour. Mildew odour is slightly different from shoe odour caused by perspiration, but is just as bad. Anytime shoes get damp and aren't dried quickly and thoroughly --- such as shoes stored in humid locker rooms, or shoes that have been drenched with rain but left to dry too slowly --- the shoes may develop this smell. Getting rid of the odour is simple: kill the mildew.
Remove insoles if possible and set them aside. If you had added additional insoles to the shoes for extra cushioning, you should throw these out and get new ones. For other insoles, allow them to dry and them spray them with a disinfectant/anti-fungal spray.
Undo the laces to open the shoe as much as possible. If the shoe is still damp, dry it with a hair dryer. To do this, set a hair dryer on high and direct the nozzle towards the inner areas of the shoe.
Spray a disinfectant spray inside the shoe. Make sure the spray gets all the way to the inner toe areas. You can do this easier by holding the shoe vertically, toe pointed down and spraying directly down into the shoe.
Set the shoes down on the floor or a table to dry overnight. In the morning, check the shoes for remaining odour. If any hint of bad odour remains, spray them again. Wait until the disinfectant spray dries before wearing the shoes.
Broad-spectrum, hospital-grade disinfectant sprays work very well for getting rid of shoe odour --- these will not only kill fungus such as mildew, but also bacteria that may be lurking in the shoes. Some veterinary/pet supply stores carry these for use in clinics and kennels. Otherwise, a generic household disinfectant spray (that kills mildew) is also fine. Avoid mildew odour in the future by keeping shoes as dry as possible. Always store damp shoes in a well-ventilated area (not a closet) and dry the shoes as soon as you can.
Do not inhale the disinfectant spray and avoid getting any in your eyes --- always spray with the nozzle pointed down or away from you.