What's the function of "ann" here?
I suggest looking at this discussion: https://www.duolingo.com/comment/6278148
In this case the Irish sentence makes more sense than the English sentence. The English sentence is just weird.
And why do we say cad is ainm duit but cad e do ghrad? Death by copula.
In cad is ainm duit, you have a relative clause. It's literally "What is it, that name to you". Cad é do ghrad doesn't have the relative clause.
So we have two ways of asking someone their name: Cad é d'ainm? and Cad is ainm duit? with the latter being more assertive?
No, with the latter being correct. "Cad é d'ainm?" is béarlachas.