As requested in this previous Mi Yodeya answer, why is rice considered kitniyot? Pesachim 114b quotes R. Huna as allowing "beet and rice" on the Seder plate in place of the lamb bone and the egg. It seems to me that a ruling in the Talmud ought to have preempted the later Ashkenazi custom.
It is not the case that a ruling in the Talmud will always overcome any possible custom developed later.
In Talmudic times, there was no customary prohibition of kitniyot. Rav Huna, in the quote, is giving an example of what may be used as the two cooked dishes, even though of course other simple dishes would be fine as well. And he specifies orez (which may very well be millet, rather than rice). And, the gemara explains, this is to the exclusion of the position of Rabbi Yochanan ben Nuri, who maintained that this was a grain, which would present problems of Chametz.
Later, with full knowledge that in previous generations, kitniyot was allowed, and with full knowledge of Rav Huna's statement, various Ashkenazi communities instituted a decree (gezeira) or accepted a custom (minhag) not to consume kitniyot, something which included rice. This, for reasons such as that wheat grains were still present in the fields from the previous harvest.
You could similarly ask how Rabbenu Gershom could decree that a man couldn't give his wife a bill of divorce against her will, or marry multiple wives, when there are explicit Talmudic statements which allow these. The answer in all cases is that your assumptions of what the proper methodology should be is not the same as the methodology with which they were operating.
While we don’t know exactly when this minhag began, one of the earliest sources to mention the custom is the Sefer Mitzvot Katan, written by Rabbi Yitzchak of Courville (France, 1210-1280). Rabbi Yitzchak writes that some communities have the custom of not eating kitniyot during Pesach, even though these items are clearly not chametz.
There are two main reasons why the custom was instituted:
Firstly, kitniyot are often grown in close vicinity to the five grains (wheat, oat, spelt, rye and barley). As such, it was not unusual for a small amount of one or more of the five grains to be intermingled with kitniyot. Thus, it was possible that one eating beans or rice on Pesach could inadvertently eat actual chametz.
Secondly, kitniyot can be easily confused with chametz for several reasons. Raw kitniyot resemble the five grains in appearance. Furthermore, kitniyot are processed in a similar manner to the five grains. For example, mustard seeds are threshed and winnowed in a manner similar to grains. Finally, kitniyot can be milled into flour, made into dough, baked into bread or cooked into a porridge that may resemble chametz. Because of the similarities between kitniyot and actual chametz, the rabbis feared that people may mistakenly believe that if they can eat kitniyot on Pesach, they can also eat chametz on Pesach.
The Vilna Gaon (1720-1790) and Peri Chadash (1586-1667) found a basis for not eating kitniyot in the Talmud (Pesachim 40b). The Gemara relates that Rava did not allow the use of lentil flour on Pesach in a Jewishly unlearned community, as he feared it would lead to confusion and cause one to mistakenly eat chametz on Pesach.
Kitniyos: The Next Best Thing to Chometz actually has a complete podcast shiur going into the details as to how, when, and why this custom arose among Ashkenaz Jews.
Only five grains can ferment to become chometz (leavened); why are so many more forbidden during Pesach? Join Rabbi Mintz, OU Kashruth Rabbinic Coordinator charged with recording OU P’sak and Policy, in a thorough exploration of the topic of Kitniyos (“legumes”). How did such a custom start among the Ashkenazim? To what foods does it apply? What about derivatives like citric acid and corn syrup? What if an Ashkenazi is invited to his Sefardic in-laws for a Pesach meal?