It all started when
His family commits a sin
On the advice of astrologers, to avert a calamity it was said that Gandhari was married to a goat before getting married to Dhritarashtra. And the goat had been sacrificed promptly thereafter. Technically, this made Gandhari a widow and Dhritarashtra her second husband., so when they come to Hastinapur as guests. Bhishma(some say it is dhritarashtra) for punishment locks all of them in his cells. But it is considered a sin to starve your guests. So bhishma cleverly sends food daily, but keeps on reducing the quantity.
The family realises this trick and then decide to feed a single person,, so that he survives and can avenge them. They select shakuni the youngest and most clever kid.Break his leg to always remind in every step of his of the atrocities that the kuru clan has committed.Before dying his mom whispers to take a particular bone from her body and that it will listen to whatever he wants
He takes them and makes them into dice.And these dice fall on the number hewishes for. Armed with dice and revenge, he acts loyal towards kauravas. He sets upon bringing down the clan by sparking a war between the cousins.