Why is isn't it "an t-ialtag"?
Because ialtag is a feminine noun. And it is a feminine noun, because it’s formed with the feminine diminutive suffix -ag. See how German Mädchen girl is a neuter noun, because it ends in a neuter suffix.
Why is leam used.
What would you expect instead? Hard to answer if we don’t know what exactly you struggle with.