While visiting a coffee shop with coffee I was offered these two kind of sugar. But don't know about differences between them. And why does brown sugar absorb moisture quickly compared to white one? And can we use brown sugar instead of white sugar or vice versa?
Brown sugar is just white granulated sugar with molasses added. Dark brown sugar just has more molasses than light brown sugar.
Coffee shops often have turbinado sugar, a common brand is Sugar in the Raw. Turbinado sugar is brown because it is less refined than white sugar.
The turbinado sugar is less "wet" than brown sugar, so it will dissolve somewhat faster than brown sugar. The molasses inhibits the sugar from dissolving quite as quickly, but will also contribute to the sugar drying in hard clumps.
Given a choice in a coffee shop, I would choose the turbinado or the white sugar. The molasses in brown sugar doesn't add anything that I want. Honestly, I can't really tell the difference in coffee between turbinado and white sugar, but I use turbinado anyway - for no particular reason.