All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
According to the majority of scholars, it is prohibited for one in the state of Janaabah to stay in the mosque. However, they say that it is permissible for such a person to pass through the mosque to do something or to call someone. Nevertheless, the Hanafi and Maaliki scholars disagree with the latter opinion.
The Hanbali scholars considered that it is allowable for the one who is in a state of Janaabah to stay in the mosque after performing ablution, because ablution reduces Janaabah. Sa‘eed ibn Mansoor and Al-Athrim reported that ‘Ataa’ ibn Yasaar said:
I saw some of the companions of the Prophet, sallallaahu ‘alayhi wa sallam, sitting in the mosque while they were in a state of Janaabah after performing ablution. [Authentic chain of narrators.]
Zayd ibn Aslam also said:
The companions of the Prophet, sallallaahu ‘alayhi wa sallam, used to enter the mosque and speak without performing ablution. Sometimes, some men in a state of Janaabah would enter the mosque after performing ablution and then sit to talk.
According to the opinion of the Hanbali scholars, it is allowable for the one who is in a state of Janaabah to stay in the mosque after performing ablution to listen to a lecture or so.
In our opinion, the preponderant opinion is that passing through the mosque for the person who is in a state of Janaabah is permissible, as Allaah Almighty Says (what means): {…or in a state of Janaabah, except those passing through [a place of prayer], until you have washed [your whole body]...}[Quran 4:43]
As for staying in the mosque, the preponderant opinion is that it is impermissible even if such a person made ablution, in contrary to the opinion of the Hanbali scholars, because this is originally forbidden, unless there is a need or a necessity. In case of necessity, one has to make ablution and then stay in the mosque until he fulfills his need.
We also see that staying in the mosque to listen to lectures specifically is not a necessity or a need nowadays, because one can make up for this by listening to similar audio and video recordings.
Allaah Knows best.