Xanthan gum is a thickening agent used in pastry fillings, pie crusts and other baked goods and sauces. Although the name may sound weird, xanthan gum is created naturally by introducing bacteria during the fermentation of corn sugar. It was originally created as a cost-effective substitute for starches and flours. While the following substitutions do work well, some of these ingredients may be more expensive than xanthan gum.
Cornstarch makes an ideal substitute for xanthan gum when used in baked goods, gravies and sauces. It's gluten-free and imparts no added flavors. Cornstarch may be kept indefinitely as long as it's stored in an airtight container in a dry environment. Products made with cornstarch are not as easy to freeze, since the low temperatures can cause ingredients to separate. Foods that are inherently acidic, like fruit pie filling, generally require a larger amount of cornstarch as a thickener.
Arrowroot has a similar appearance and consistency to cornstarch. The arrowroot plant is native to South America where historically it served many purposes. When used as a thickening agent, it coagulates at a lower temperature than cornstarch. However, more arrowroot powder is needed to produce the same effect as xanthan gum.
Gelatin is made from boiled animal bones and other tissues (kosher gelatin can be produced from fish bones). This product is most often associated with colorful desserts and store-bought pastry fillings. While gelatin is a viable substitute for xanthan gum, vegetarians and vegans tend to avoid it because it's an animal product.
Agar agar is a seaweed gathered from the East Indian shore and produced mainly in China. It's seen most often in Eastern countries in jellies and soups. Agar agar makes an ideal vegan or vegetarian thickening agent as it contains no animal byproducts.