I may just be cynical but I don’t believe goodwill is enough of a reason, especially as the Ottomans were having their own problems as well as being very far from Ireland.
I wrote about this story in some detail here, and the long version may be of some interest to you.
The short version is that there's very little first hand evidence as to exactly why Abdülmecid I made his contribution to famine relief, but the plight of Ireland was very widely discussed at the time, and similar contributions were made from equally distant parts, perhaps most notably by the members of the Choctaw tribe in the Oklahoma territory.
Abdülmecid did have an Irish doctor, Justin McCarthy of Cork, and hence we do know there was someone with regular access to the sultan, personal contacts in Ireland, and a likely strong interest in events there. It's quite possible McCarthy had something to do with the donation, but the contemporary evidence does not allow us to be certain about this.