Basically, Muslims can pray anywhere as long as the place is clean and dry e.g at home, office, open air areas etc. But, it is always preferable and meritorious to pray in congregation at a mosque. This gathering of Muslims at a mosque five times daily, is a step towards the establishment of healthy social relations, equality, unity, discipline as well as enhances the prestige of Islam. Moreover, the reward for congregational prayer is multiple times that of praying individually and so Muslims prefer going to the Mosque to say their prayers.
It is also important to know that Muslims offer every prayer, be it at home or in the Mosque, facing towards Mecca, a city in Saudi Arabia which known as the Qiblah. The Qibla itself is a single box like room, built by Prophet Abraham and his son Prophet Ismail.