You need two functions working together. The outer function walks every node in root and asks: "does the tree rooted here match subRoot?" The inner function answers that by comparing two trees node by node.
The inner check (isSameTree) returns true only if both trees are structurally identical with matching values at every position. If either node is null or values differ, it returns false.
The outer function recurses through root. At each node, it calls isSameTree. If that fails, it tries the left child and right child. If any path returns true, you found a match.