The explanation is straight forward. The demons acknowledge Jesus as "son of god." They do not confess He is "The Son of God:"
And behold, they cried out, “What have you to do with us, O Son of God?... (Matthew 8:29) [ESV]
καὶ ἰδοὺ ἔκραξαν λέγοντες τί ἡμῖν καὶ σοί υἱὲ τοῦ θεοῦ ἦλθες ὧδε πρὸ καιροῦ βασανίσαι ἡμᾶς
Whoever confesses that Jesus is the Son of God, God abides in him, and he in God.
(1 John 4:15)
ὃς ἐὰν ὁμολογήσῃ ὅτι Ἰησοῦς ἐστιν ὁ υἱὸς τοῦ θεοῦ ὁ θεὸς ἐν αὐτῷ μένει καὶ αὐτὸς ἐν τῷ θεῷ
Anyone born of a woman of Jewish ancestry, who was a son of Abraham (Matthew 1:1) could make the claim God was their father, and, therefore, be called a son of God:
39 They answered him, “Abraham is our father.” Jesus said to them, “If you were Abraham's children, you would be doing the works Abraham did, 40 but now you seek to kill me, a man who has told you the truth that I heard from God. This is not what Abraham did. 41 You are doing the works your father did.” They said to him, “We were not born of sexual immorality. We have one Father—even God.” (John 8)
Calling one of Jewish ancestry a son of God, as the demons do, essentially is an Old Testament presumption. That is to say, the demons could have called Peter, James, John, or any of those of Jewish ancestry traveling with Jesus, "σοί υἱὲ τοῦ θεοῦ" (you son of God). However, John states you must confess Jesus is the Son of God. He is not "Jewish" although He is of Jewish ancestry; He is the only-begotten Son of God. This the demons did not do.
Jesus went on to say their "father" was the devil, not God:
You are of your father the devil, and your will is to do your father's desires. He was a murderer from the beginning, and does not stand in the truth, because there is no truth in him. When he lies, he speaks out of his own character, for he is a liar and the father of lies. (John 8:44)
Therefore, the demons, like those whom Jesus is addressing in John 8, are of their "father," the devil; they are not of God.