The mitzvah for Hakhel (lit. to gather or to assemble) can be found in sefer Devarim, perek 31:10.
And Moshe commanded them, saying, At the end of every seven years, in the time of the year of release, in the feast of booths, when all Yisrael is come to appear before the L-rd thy G-d in the place which he shall choose, thou shalt read this Torah before all Yisrael in their hearing.Gather the people together, men, and women, and children, and thy stranger that is within thy gates, that they may hear, and that they may learn, and fear the L-rd your G-d, and observe to do all the words of this Torah.
The Ibn Ezra, on the sentence "and thy stranger" explains why the "ger", e.g. the stranger is mentioned:
and your stranger: Maybe he will convert to Judaism
The Lubavitcher Rebbe, in Likkutei Sichos, vol. 19, p. 369 explains that the deeper meaning behind this mitzvah is to strengthen our inner faith.
Based on the words of the Rebbe, the following question occurs:
- Why is, specifically in this mitzvah, the convert included? Why especially with this mitzvah? Is there a deeper meaning behind this, besides the fact that there might be people that want to convert, as Ibn Ezra explains. Hakhel serves as a mitzvah that will ensure that we may "hear, and that we may learn, and fear the L-rd our G-d, and observe to do all the words of this Torah".
The Lubavitcher Rebbe wrote what Hakhel might include nowadays, namely to bring people to learn Torah, bring them to Yeshivoth etc..:
Therefore, let every Jewish father and mother, every Rabbi and leader, every communal worker and person of influence, heed the call of the Mitzvah of Hakhel: to gather the masses of Jewish children and bring them to the Yeshivoth, Talmud Torahs and Torah - true educational institutions; to increase the Torah-Tzedoko, the support of true Torah institutions and ensure their existence and growth, in order that all Jewish children boys and girl, be brought up in the spirit of piety and love for G‑d, love for the Torah and Mitzvoth, love for one another.