Different antibiotics are used to treat infections caused by different bacteria. (Or, if an infection is particularly serious, the doctor might prescribe a stronger antibiotic with a greater risk of side effects because the risk vs. benefit ratio would call for a drug that is more likely to kill the bacteria more quickly and completely.) Some patients are also allergic to some antibiotics, which would, of course, affect the choice.
In an ideal world, the doctor might send a culture to the lab to determine what bacteria is responsible, and pick the antibiotic that is best. More often, the doctor knows that, for example, an ear infection is most often caused by one type of bacteria, and a bladder or sinus infection caused by another. So she'll often prescribe based on 'best guess' and either send the culture off just to be sure, or tell you that if things aren't better in X number of days, to call back and she will prescribe something else and/or send the culture.
If you've been sick for 'years now' it's not an infection. Could be allergies ,but by all means return to the doctor for a more thorough evaluation. (Perhaps a referral to an ENT would be appropriate.)