Think of it like this.
$a^{2}$ means $a \times a$.
More generally, $a^{n}$ means $\underbrace{a \times a \times a \times \dots \times a}_{n \text{ times}}$.
So $2^{3}$ means $2 \times 2 \times 2$. That's $2 \times 2$, $3$ times.
Therefore $(2x^{2} + x)^{2}$ means $(2x^{2} + x) \times (2x^{2} + x)$.
Now, using your number, we see that:
$(2 \times 3^{2}) + 3 = 18 + 3 = 21$
And $21 \times 21$ is very different to $(2 \times 3^{4}) + 3^{2} = 162 + 9 = 171$.
What you have learned the hard way is that exponentiation is not distributive over addition. Which means that $(a + b)^{2} \neq a^{2} + b^{2}$. Why is this? Because $(a + b)^{2}$ means:
Multiply $(a + b)$ by $(a + b)$
Not multiply $a$ by $a$ and multiply $b$ by $b$ and add them together.
For a more simple example than yours, let's look at $(3 + 2)^{2}$
$(3 + 2)^{2} = (3 + 2) \times (3 + 2) = 5 \times 5 = 25$
But:
$(3 + 2)^{2} \neq 3 \times 3 + 2 \times 2 = 9 + 4 = 13$
N.B.: Here we are talking about the general case. There is certainly one specific example of where $(a + b)^{2} = a^{2} + b^{2}$ but this is basically just by coincidence.