Xanthan gum has a number of powerful properties. First, it works as an emulsifier, encouraging liquids that normally don't like one another to mix together. Second, it works as thickener, increasing the viscosity of liquids and batters. Third, it can create a creamy texture.
In the world of gluten-free baking, xanthan gum plays the crucial role of imitating gluten. In baking, gluten is what makes dough "doughy." It gives the dough elasticity, as well as viscosity. Those properties help to hold a cookie together while it bakes on a sheet in the oven, and they enable cakes and breads to hold onto the gas bubbles that form inside them - this allows them to rise and take shape. Xanthan gum helps replicate these properties in recipes that do not contain gluten.