In my opinion, it is incorrect. I think that only one of the following two ways is grammatically correct:
- My teacher was in Beijing yesterday.
- Yesterday my teacher was in Beijing.
However, my son who is in an international school in China (Grade 8) was told by one of his native English (American) teachers that this sentence is correct. I have checked it on Grammarly as well and it also does not show any correction for this sentence; meaning that it is correct according to Grammarly as well. I still feel that it is incorrect to say this sentence as "My teacher yesterday was in Beijing." However, I am unable to explain grammatically why it is incorrect.