A Giffen good is an extreme type of inferior good. The negative income effect of changes in price of a Giffen good is actual stronger than the substitution effect. This leads to its bizarre quality: when the price of a Giffen good rises, consumers actually buy more.To understand how this happens, consider the example of a Giffen good for which there is the best evidence that it is a Giffen good. Households in the Hunan province of China were shown to buy more rice when they had to buy it at a higher price, and less when the price they paid was subsidised.
The reason for this is that, even when expensive, rice was still the cheapest source of calories available. Therefore, when the price of rice was cut, households had more money left over after buying rice. Some of this was spent on buying more expensive foods (meat, vegetables and fruit), which reduced their need for rice.

And it violates the law of demand because according to the law of demand, the demand of a good decreases with increase in price, but in the case of a giffen good, demand increases with price increase.That violates the law of demand.