Without knowing the ingredients I can't tell you exactly but I can tell you what would usually make a deodorant bar go grainy.
The butters used are likely to be the culprit. Mango and Shea butter are notorious for becoming grainy. The reason is the fatty acid profile of these butters.
Let's take Shea butter as an example.
Shea butter contains both palmatic and stearic acid. They have different melting points and solidification points. When they are solidifying at different temperatures they create this grainy effect that appears on the picture you included. If the solidification points were the same it would create a smooth bar.
I'm assuming that it wasn't like this when you bought it. Therefore the stick has probably melted to a certain degree and then as its setting up the grains have formed.
The way I prevent this from happening is to cool my products that contain Shea very quickly in the refrigerator or freezer even.
You could try to re melt your deodorant and then set it again in the fridge or freezer. However I can't guarantee this will work as I don't know the ingredients. Assuming that you won't use the product as it is, it's worth trying.
In future, during hot weather, you can keep your deodorant in a cool place to ensure that it doesn't happen again.