The statement that Jewish identity is determined by the mother is found in the Mishnah (Kiddushin 3:12), which says that the child of a gentile woman is like her. The Talmud derives this from the passage in Deut. 7:3-4: "Do not intermarry with [him], do not give your daughter to his son or take his daughter for your son, for he will turn your son from Me": A child born to your daughter (fathered by a non-Jew) is called "your son", but a child born to your son (by a non-Jewish mother) is not called "your son", but "her son".
The Talmud is assuming here that the "he" in Deut.7:4 is your gentile
son-in-law, and that "your son" whom "he" will turn away from G-d is your grandson, born to him and to your daughter. The Torah calls that grandson "your son" because he is regarded as Jewish since he had a Jewish mother. In the other case, where a Jewish man marries a gentile woman, the Torah doesn't speak about the woman's influence on her children (i.e., it doesn't say "for she will turn your son from me"), because her children are non-Jewish to begin with since their mother is non-Jewish. Apparently we are more concerned about the influence of a non-Jewish spouse on the children than about the influence of a non-Jewish spouse's parents on their children-in-law.
The Talmud (Kiddushin 68b) asks how we know that these laws apply
to any non-Jews, since the cited verse refers to the Canaanites.
The answer given there is that "he will turn your son [away from
Me]" implies that all those who might turn [sons] away are included
in the prohibition.
Ask a follow-up question