Q. Where in the Torah does G-d command us to observe Shemini Atzeret & Simchat Torah as a holiday?

A. On Vayikra (Leviticus 29: 39) “But on the fifteenth day of the seventh month, when you gather in the produce of the land, you shall celebrate the festival of Hashem for a seven day period; the first day shall be a rest day, and the eighth day shall be a rest day.” And on Bamidbar (Numbers 29: 35) “The eighth day shall be a time of restriction (Bayom Hashmini Atzeres) for you; you shall not perform any mundane work.”

The 22 day of Tishrei, the day after the seventh day of Sukos, is the holiday of Shemini Atzeres. In Israel, Shemini Atzeres is also the holiday of Simchas Torah. Outside of Israel, where two days of Yom Tov are held, only the second day of Shemini Atzeres is Simchas Torah:

Sh’mini Atzeret is not the eighth day of Sukkot; but a Yom Tov of Pilgrimage on its own accord (Rosh HaShanah 4b, Suka 47a, Chagiga 17a et. al.)

Simchas Torah is not mentioned in the Torah itself. The name Simchas Torah is relatively new. One of the early sources is Darchei Moshe (O.H. 669: 3) who cites Maharik responsa (26) quoting from the Geonim the custom of dancing on the Yom Tov of Simchas Torah.

However, it goes back even further. Horav Shlomo Miller Shlit’a pointed out that the Talmud (Megila 31a) tells that they would finish the reading the Torah on that day.

Remah in Shulchan Aruch (O.H. 669: 1) mentions that we call the day Simchat Torah, since we rejoice when we finish reading the Torah. Biur Hagrah (ad loc.) cites as the source the Midrash Rabbah at the beginning of Koheles. Besides other Midrashic sources, Simchat Torah is also mentioned in Zohar (Pinchas 256) and Tikuney Zohar (Tikun 21)
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a