The version of the story I am familiar with, "An Appointment in Samarra", has a different venue but in other respects it is almost identical. This is a retelling of an ancient Mesopotamian legend by W. Somerset Maugham in 1933, which appeared in his play "Sheppey". The story runs as:
There was a merchant in Bagdad who sent his servant to market to buy
provisions and in a little while the servant came back, white and
trembling, and said, Master, just now when I was in the marketplace I
was jostled by a woman in the crowd and when I turned I saw it was
Death that jostled me. She looked at me and made a threatening
gesture, now, lend me your horse, and I will ride away from this city
and avoid my fate. I will go to Samarra and there Death will not find
me. The merchant lent him his horse, and the servant mounted it, and
he dug his spurs in its flanks and as fast as the horse could gallop
he went. Then the merchant went down to the marketplace and he saw me
standing in the crowd and he came to me and said, Why did you make a
threating getsture to my servant when you saw him this morning? That
was not a threatening gesture, I said, it was only a start of
surprise. I was astonished to see him in Bagdad, for I had an
appointment with him tonight in Samarra.
As wikipedia notes, Maugham's retelling originates from the Babylonian talmud, Sukkah 53a, which changes the venue again, this time to Luz:
There were once two Cushites who attended on Solomon, and these were
Elihoreph and Ahyah, the sons of Shisha, scribes, of Solomon. One day
Solomon observed that the Angel of Death was sad. ‘Why’, he said to
him, ‘art thou sad?’ — ‘Because’, he answered him, ‘they have demanded
from me the two Cushites who sit here’. [Solomon thereupon] gave them
in charge of the spirits and sent them to the district of Luz. When,
however, they reached the district of Luz they died. On the following
day, he observed that the Angel of Death was in cheerful spirits.
‘Why’, he said to him, ‘art thou cheerful?’ — ‘To the place’, the
other replied, ‘where they expected them from me, thither didst thou
send them!’ Solomon thereupon uttered the saying, ‘A man's feet are
responsible for him; they lead him to the place where he is wanted’.
The same story is also present in Islamic literature, with the venue shifted again, this time to India:
Abū ‘l-Shaykh from Dā’ūd ibn Abī Hind; he said: It reached me that the
Angel of Death was made responsible for Solomon (peace be upon him),
and he was told: ‘Go into his presence every day, and ask what he
needs; then do not leave him until you have performed it.’ He used to
enter upon him in the image of a man, and he would ask him how he was.
Then he would say: ‘Messenger of God, do you need anything?’ If he
said: ‘Yes’, then he did not leave him until he had done it; and if he
said: ‘No’, then he left him until the following morning. One day he
entered upon him while there was an old man with him. [Solomon] stood
up, and greeted [him], then [the Angel of Death] said: ‘Do you need
anything, Messenger of God?’ He said: ‘No.’ The [angel] glanced at
[the old man] and the old man trembled; the Angel of Death left and
the old man stood up and said to Solomon: ‘I beg you, by the truth of
God! to command the wind to carry me and throw me down on the furthest
lump of mud in the land of India (hind)!’ So [Solomon] commanded it
and it carried him [there].
The Angel of Death came unto Solomon the next morning and asked him
about the old man. [The Angel of Death] said: ‘His book came down to
me yesterday, [saying] that I should take his soul tomorrow at the
rising of dawn in the furthest lump of mud in the land of India; but
when I came down, and thinking that he was there, I then found him
with you. I was astonished and could not think of [anything] other
than him; I came down to him today at the break of dawn and found him
on the highest lump of mud in the land of India, and he trembled, and
I took his soul (rūh).’
[from Angels in Islam, a translation of Jalal al-Din al-Suyuti's al-Haba'ik fi akhbar al-mala'ik)]
> quote here