The Alter Rebbe (Tanya, Likutei Amarim, chapter 5) explains that when we study Torah, G-d clothes the soul and envelops it from head to foot with the Divine light:
Hence the special superiority, infinitely great and wonderful, that is in the commandment of knowing the Torah and comprehending it, over all the commandments involving action, and even those relating to speech, and even the commandment to study the Torah, which is fulfilled through speech. For, through all the commandments involving speech or action, the Holy One, blessed be He, clothes the soul and envelops it from head to foot with the Divine light. However, with regard to knowledge of the Torah, apart from the fact that the intellect is clothed in Divine wisdom, this Divine wisdom is also contained in it, to the extent that his intellect comprehends, grasps and encompasses, as much as it is able so to do, of the knowledge of the Torah, every man according to his intellect, his knowledgeable capacity, and his comprehension in Pardes.
Similary, in chapter 4 of Tanya, the Alter Rebbe writes:
Thus, since the Torah and its commandments "clothe" all ten faculties of the soul with all its 613 organs from head to foot, it [the soul] is altogether truly bound up in the Bundle of Life with G‑d, and the very light of G‑d envelops and clothes it from head to foot, as it is written, "G‑d is my Rock, I will take refuge in Him," and it is also written, "With favour (ratzon— will) wilt Thou compass him as with a shield," that is to say, with His blessed will and wisdom which are clothed in His Torah and its commandments.
So, what exactly does the statement "Ana Nafshi Ketivat Yehavit" means?
The answer can be found here:
כאשר הקב"ה נתן את התורה בהר-סיני, הוא פתח במלה 'אנכי'. אומרת על כך הגמרא, ש'אנכי' ראשי-תיבות: "אנא נפשי כתבית יהבית" (=אני את נפשי כתבתי ונתתי). כלומר: בתורה נתן לנו הקב"ה את עצמו, כביכול. הוא הלביש בה את חכמתו האין-סופית ואת רצונו העצמותי. כאשר יהודי לומד את התורה, מתמזג שכלו עם שכלו של הקב"ה, כביכול.
אנא נפשי כתבית יהבית means that G-ds very essence is within the Torah and, when we study the Torah, we so-to-speak "merge with G-d".
The Torah is G-ds "divine wisdom" as the Alter Rebbe (Tanya, chapter 5) explains. Through Torah study, we can "grasp" that divine wisdom and merge with G-ds mind so to speak. Our soul is clothed with G-ds wisdom, the Torah, as R' Nachman of Breslov writes in Sichot HaRan 23:3:
The clothes one needs in that place are Torah and good deeds