"Ho il gelato al caffè."
The short answer is that prepositions are idiomatic.
A slightly longer answer:
Prepositions are used in different ways in different languages. No other language uses its prepositions in the exact same manner that English does. Prepositions in English also present many inconsistencies such as "sleep IN the bed" but "sleep ON the couch" but as a native speaker you don't notice this because you automatically know which is the right preposition for each situation. For people learning English, however, prepositions can be very confusing. (Why do we say "he will be here AT 4pm" but "he will be here ON Monday" and "he will be here IN the morning"...?)
The best you can do as far as Italian goes is just learn what I will call "the most likely meaning" for each preposition and then remember that "most likely" is not the same thing as "always". In fact it's probably not even close to always, and every preposition has multiple exceptions to the rule.
Yes a common meaning of 'al' in Italian is 'at the'. But it's certainly not the only use it has. One of those other uses is that 'al' is also commonly used in food expressions: le banane al cioccolato (chocolate bananas), la crema al cioccolato (chocolate cream), il gelato al caffè (coffee icecream).
I have iced coffee? Maybe this is what you want to say, but in English it's just a tad wierd.
il gelato al caffe means coffee ice cream. The modifier (coffee) comes after the noun (ice cream) in Italian. Or at least it does 95% of the time. There are some occasions when the modifying word comes before, but those are exceptions not the rule.
iced coffee would be something like "caffè freddo" or "caffè giacchiato"