No, it is not compulsory. You could stay at your own accommodation, too. However, staying at the university hostel would help you immerse totally in the learning experience.