Stong's Lexicon describes νομοδιδάσκαλος as: "an expounder of the (Jewish) law, i.e. a Rabbi: — doctor (teacher) of the law." I believe this definition is accurate. Although "teachers of the law" can mean "scribes" it is more likely to refer the Pharisees generally, also called "rabbis."
The Pharisees were teachers of the law who understood their mission as making the Torah, the "Law of Moses," accessible to the masses of Jews. They were instrumental in establishing synagogues as centers of worship and teaching, as opposed to the attitude of the Sadducees, who were mostly of priestly families and concentrated on the Temple in Jerusalem. According the Encylopedia Britannica
- About 100 BCE a long struggle ensued as the Pharisees tried to democratize the Jewish religion and remove it from the control of the Temple priests. The Pharisees asserted that God could and should be worshipped even away from the Temple and outside Jerusalem. To the Pharisees, worship consisted not in bloody sacrifices — the practice of the Temple priests — but in prayer and in the study of God’s law. Hence, the Pharisees fostered the synagogue as an institution of religious worship, outside and separate from the Temple.
The Pharisees later became known simply as "rabbis," the Jewish term for teachers; and their subject was the Law of Moses. In the synoptic gospels Jesus is addressed with the the Greek word for Teacher [did-as'-kal-os]. In the Gospel of John, the title "Rabbi" is often given to Jesus by his disciples (John 1:49, 3:26, etc.) At the time of Jesus, there were two main Pharisaic "schools," that of Hillel and that of Shammai. The former was broad-minded and the latter more strict. On most issues of Jewish Law (with the notable exception of divorce), Jesus' outlook can be seen as relatively compatible with Hillel's views, and those of his opponents echoed the opinions of Shammai. We get a sense of the attitude of Hillel's school from Act 5:34:
- But a Pharisee in the council named Gama'li-el, a teacher of the law, held in honor by all the people, stood up and ordered the men to be put outside for a while...[He said] "keep away from these men and let them alone; for if this plan or this undertaking is of men, it will fail; 39 but if it is of God, you will not be able to overthrow them. You might even be found opposing God!”
Gamaliel, was, in fact, the grandson of Hillel.
The Apostle Paul was not only a former Pharisee but continued to identify as a Pharisee throughout his life. For example in Acts 23:6, when "Paul perceived that one part were Sad′ducees and the other Pharisees, he cried out in the council, “Brethren, I am a Pharisee, a son of Pharisees; with respect to the hope and the resurrection of the dead I am on trial.”
That Paul continued to think of himself as a Pharisee and that Jesus himself might have been a pharisaic rabbi or "teacher of the law" is a shocking proposition to many Christians who understand the Pharisees to be Jesus' primary enemies. However in Jesus' day "Pharisee" was not a negative term, and it is certainly true that Jesus engaged in debate with his fellow rabbis about matters of Jewish law:
- Is healing on the sabbath permitted? - Matthew 12:10
- Must common people wash their hands before eating? Matthew 15:2
- Under what circumstances is divorce allowed? - Matthew 19:8
- Should Jews pay Roman taxes, and with which coins? Mark 12:14
- Will the dead be resurrected? Matthew 22:23
- Is it sufficient to refrain from swearing falsely or must one always tell the truth? - Matthew 5:33
- Is it sufficient to refrain from murdering, or must one not even be angry? Matthew 5:22
- Is it enough to be sexually faithful to one's wife or must we not even look lustfully on another woman? Matthew 5:27
- What commandments is it essential to keep if one is to enter eternal life? Luke 10:25
These and many other issues that Jesus taught about or debated with the other teachers place him squarely in the tradition of what Jews call "halakhic discourse" - discussion by Jewish teachers regarding how the Law of Moses should be interpreted and applied in daily life. See "The Halakhah of Jesus of Nazareth according to the Gospel of Matthew[(https://www.amazon.com/Halakhah-Nazareth-according-Biblical-Literature/dp/1589832825) by Phillip Sigal for a detailed analysis.
The Gospel of Luke seems to characterize Jesus himself as a "teacher of the Law," although his conclusion regarding the mission of the Messiah is different radically from the mainstream view.
- Beginning with Moses and all the prophets, he interpreted to them the things about himself in all the Scriptures." (Lk 24:27)
Critical scholars theorize that the seeming constant animosity between the Pharisees and Jesus is a product of the time that the Gospels were written. By that time, Jewish Christians had been expelled from many synagogues, not because of Jesus' liberal interpretation of the Law, but because of the church's emerging teachings about salvation, Christology and alleged Jewish culpability for Jesus' death. According to such analyses, Jesus' actual debates with his fellow rabbis about issues of Jewish law would not have placed him out of the mainstream.
Whether one agrees with this or not, it is clear that "teachers of the law" does not apply to scribes alone but the Pharisees or rabbis generally. It is used pejoratively to refer to those rabbis/teachers who opposed Jesus. But in the case of Gamaliel, it is not a negatively charged term. Jesus may actually have been one of the "teachers of the law."