The yeast infection was a response by your body. EIther way it could be because you used the tampon improperly and it was blocking in moisture, or destroying your skin, or it was scented which caused you to have some kind of allergic reaction. Or it might just be a coincidence that you had a yeast infection at the same time that you used a tampon.
Either way I hope you are not still using tampons, use pads that are completely unscented. You need to get on a complete candida diet, because you've been sick for 5 years it cannot be something minor. It's something that you need to look into taking care of.