No, it is not mandatory to stay at the hostel in your 1st year. You can leave the hostel at any point if you feel the requirement. However, it is best if you stay there because it can help you in the upcoming exams. It can assist in saving up your travel time.
You can also acquire a lot of assistance from the people staying at the hostel, besides you. The major pitfall is usually felt by students who live outside the hostel premises as it can be difficult to run back and forth between your residence and the campus.