7. $\{-4,2,4,5,25\}$.

Since $A \cap B=\{2,5\}$, we have $x^{3}-2 x^{2}-x+7=5$, so $A=\{2,4,5\}$. Given $Z \in B$, if $y+$ $3=2$, then $y=-1, B=\{-4,2,5,4\}$, and $A \cap B=\{2,4,5\}$, which does not meet the condition; if $y^{2}-2 y+2=2$, then $y=0$ or $2, B_{1}=\{-4,3,2,7\}$ or $B_{2}=\{-4,5,2,25\}$, discard $B_{1}$; if $y^{3}+y^{2}+3 y+7=$ 2, then $y+3=5$ or $y^{2}-2 y+2=5$, which gives $y=2$ or -1 or $3. y=3$ results in $B=\{-4,6,5,52\}$, and $A \cap B=\{5\}$, which does not meet the condition. Therefore, $B=\{-4,5,2,25\}$.
7. If the set $A=\left\{2,4, x^{3}-2 x^{2}-x+7\right\}, B=\left\{-4, y+3, y^{2}-2 y+2, y^{3}+y^{2}+3 y+7\right\}$, and $A \cap B=\{2,5\}$, then $A \cup B=$