There is a mosque in the compound where we live, but some people prefer to offer their obligatory prayer in their rooms. On the other hand, there are three mosques near our working site. Nevertheless, employees gather to have their congregational prayer on site, rather than go to one of those three mosques.
Congregational prayer is one of the duties of the Muslim community.
Mosques provide such congregation and they must be used. Moreover, congregational prayer is rewarded 27 times more than the same prayer when offered individually. To show how important offering the prayer with the congregation in the mosque is, I will refer to the time when Amr ibn Umm Maktoom, a blind companion of the Prophet, asked him whether he could offer prayer at home, because sometimes he did not feel up to walking to the mosque, particularly with roads being uneven and having some pitfalls. The Prophet asked him whether he could hear the athan, i.e. the call. When Amr said that he could, the Prophet told him that he could not find any justification for him to stay at home.