Why it happens
Rice needs enough water and time for its starch to absorb liquid and soften all the way through. If there wasn't enough water, the heat was too high so the water evaporated too fast, or the lid wasn't on tightly, the rice runs dry before the centre of each grain cooks. Brown rice and some other varieties need more water and a longer cooking time than white rice.