There is an obligation to be b’simchah on Yom Tov, as the pasuk says V’samachta b’chagecha (Devarim 15:14). The Mishnah in Sukkah 48a says that one is obligated to be b’simchah on the eighth day as well. The Gemara there derives this from the pasuk “V’hayisa ach same’ach” (Devarim 15:15). The Gemara questions that perhaps the drasha should come to include the first night of Sukkos; instead of the eighth day. The Gemara resolves that the drasha implies that the day that is being included has an obligation of simchah right before it and we are simply extending it. Since the first night of Sukkos does not have an obligation of simchah before it, as Sukkos has not yet started, we cannot include it in the drasha.
It is apparent from this Gemara that the first night of Sukkos does not have an obligation to be b’simchah min haTorah. However, asks the Shagas Aryeh (siman 68), the Gemara in Moed Kattan 14b says that an aveil cannot perform aveilus on Yom Tov because there is a mitzvah of simchah that applies to everyone which takes precedence over his personal asei of avelus. If there is no mitzvah of simchah on the first night of Sukkos, why can’t an aveil perform aveilus that night. On the first night there is no asei of simchah that is docheh his personal assay.
Tosfos in Moed Kattan (14b) says that in fact the mitzvah of simchah is only m’d’Rabanan. He explains that aveilus is only m’d’Rabanan as well. Therefore the two mitzvos are in fact equal in the sense that neither is min haTorah. Since the mitzvah of simchah applies to everyone it takes precedence over the personal mitzvah of avelus.
However the Rambam explicitly disagrees and posits that the mitzvah of simchah on Yom Tov is in fact min haTorah. According to his view, we need to explain the apparent contradiction from the above mentioned Gemaras.
The Shagas Aryeh leaves the matter somewhat unresolved, and posits that on the first night one is only obligated in simchah m’d’Rabanan.
To better understand this we must know what forms of simchah are included in the obligation. The Gemara in Pesachim 109a says that in the times of the Beis Hamikdash the only form of simchah was with meat from the korban Chagiga. When the Beis Hamikdash is not standing, simchah is performed with wine. The Gemara continues that one is obligated to ensure that his entire household is happy with the appropriate items. The Gemara explains, men with wine, women with nice clothing. The Gemara implies that this obligation is min haTorah.
Rav Chaim Soloveitchik (in the stencils) says that we see that there are two forms of simchah min haTorah. One is the simchah attained of eating the korbanos. The other form of simchah is performed by doing things that are not kadosh, but also bring about simchah. Now that we do not yet have a Beis Hamikdash we are only left with the latter form of simchah.
Rav Chaim explains that the Gemara in Sukkah that attempted to include the first night of Sukkos in the obligation of being b’simchah was referring to the simchah attained from the korbanos. It is in regards to the obligation of simchah performed with korbanos that the Gemara resolves that the first night is exempt from simchah, and Shimini Atzeres is included. Rav Chaim explains that it is logical that the Gemara was only referring to the simchah of korbanos because that is the only simchah that requires action on the day before, i.e. to shect the korban on erev Yom Tov. Since there is no obligation of simchah on erev Sukkos the Gemara says that the first night is excluded from that form of simchah. Shimini Atzeres, which does have an obligation of simchah on the day before, can be included in the mitzvah of simchah of korbanos. Alternatively, Rav Chaim explains that since there is no obligation of simchah on erev Yom Tov even if one would shect a korban then it would not attain the status of a koban Chagiga. However, the first night of Sukkos still has the obligation min haTorah of simchah that is performed with the mundane objects.