No one spoke Hebrew at the time. It had been superseded by Aramaic from the time of the Babylonian exile and Aramaic remained the common vernacular language. But Koine Greek was the language of the literate class who could write, which certainly would have included tax collector Matthew. Koine Greek dominated the region since the conquest by Alexander the Great three hundred yrs earlier. Koine was so dominant a group of Jews in Alexandria Egypt had sponsored the translation of the OT from Hebrew into Greek, which is today known as the Septuagint.
I’m not so sure Greek was widely spoken as modern authorities assume. Josephus (an obviously highly educated person in leadership in Judea) wrote Wars of the Jews in Aramaic. He then tried to learn Greek in order to translate it into Greek. He failed, and then hired a translator. There is no doubt that Alexandrian Jews spoke Greek, which is why the Septuagint was created. But, I doubt that the average person in the New Testament narrative spoke Greek.