Yes, Diflucan is for fungal infections (yeast is a fungus). It is a prescription drug, and the generic medication for that is called Fluconazole (it should be much cheaper, especially if you buy it from places like Walmart where it qualifies for the $4 prescription cost). It treats fungal infections all over your body (vagina, mouth, throat, esophagus, abdomen, lungs, blood, and other organs). Maybe your doctor saw an infection elsewhere?
Vaginal yeast infections can be treated with the normal over the counter things like Monistat.