Hey there! I'm sure we've all had crushes on older people before.
I don't think there is anything wrong with it because I will assume your teacher is older and married. If not, it is highly likely things will not happen between you two anyway because of legal disputes, etc. It will most likely pass, especially when you switch grades and have newer teachers.
It is perfectly fine, just don't do something inappropriate that may conflict with school rules. It's totally fine to talk to your teacher and get to know them!
Best of luck to you!!