Thank you for this interesting question. Judaism has an incredible history of laws and customs and understanding their intent and origin can be helpful to us in living a more mindful and meaningful life.
Yes, there is a widespread custom of throwing out the shoes of a deceased person. This custom, however, has no basis in any of the classical Jewish sources. In fact, one who discards a deceased person’s shoes, which could have been useful to someone else, violates the prohibition of bal tash’chit, wanton destruction.
The most common reference point of this custom is from the 13th century German work, Sefer Hasidim, where it says:
A person should not give tzedakah from something which is dangerous. A person was given shoes of the dead (min’alim shel met) and he wanted to give them to the poor. They said to him: “Love your neighbor as yourself” (Leviticus 19:18). Rather sell them to a gentile so that no Jew should be endangered and then give the proceeds to the poor.
First of all, it should be noticed that this source says that one should sell the shoes to a gentile and then give the proceeds to tzedakah, not throw them away.
Second, the text is clearly intended to prevent harm and danger (from Jews; we should, of course, include everyone). Therefore, most scholars today interpret the phrase “shoes of the dead,” min’alim shel met, to refer to shoes made from a dead animal carcass, which in Hebrew is practically identical, i.e., min’alim shel metah (a difference of one letter, adding a heh). In context, this interpretation makes much more sense because a) Sefer Hasidim discusses many health related concerns in this section, and b) shoes made from a dead animal carcass could be considered dangerous, such as if the animal died from a snakebite and the poison was absorbed by the hide. To prove the point further, this interpretation directly correlates to a teaching in the Talmud (Chullin 94a), followed by a comment by Rashi:
Our rabbis have taught: one should not sell his friend a sandal made from an animal who died (sandal shel metah) as if it was made from a slaughtered animal for two reasons: first of all because of deception and secondly because of danger.
Rashi: lest the animal died of snakebite and the poison was absorbed in its hide.
Thus, it is not only permissible, but a mitzvah to donate the shoes (and clothes) of a dead person to both Jews and non-Jews.