Salam Saman,
Regarding the first sentence, it's either we say:
- يدخل الأستاذ الصفَّ
Or
- يدخل الأستاذ إلى الصفِّ
Both work just fine, and in the second case, using إلى instead of في is correct.
Now to the second sentence, it's either we say:
- ندخل المعهد
Or
- ندخل إلى المعهدِ
I hope the answer is clear and makes sense to you.