Capernaum was a small fishing village near the Sea of Galilee. There is evidence of a 4th century synagogue there that some suggest was built on an earlier one that may have been the one referenced here. This is one of those verses that make trouble for those who view Jesus as a 30-something carpenter from the sticks – when would he have learned to read? What tradition was he taught from? Which political subgroup claimed him?
If, however, Jesus was a high priest and a nazirite, then he could have entered any synagogue on any sabbath and it would have been expected for him to teach and for his words to have authority. It wouldn’t be weird. It probably wouldn’t have even been a surprise. He would have taught as one with authority, having been a high priest and therefore a Pharisee.