D'Alembert's Principle: Where does $-Q_j$ come from?

General explanation. Similar to Newton's 2nd law, the D'Alembert's principle has both a dynamical and a kinetic term,

$$ \sum_i (\mathbf{F}^{(a)}_i - \dot{\mathbf{p}}_i) \cdot \delta \mathbf{r}_i~=~0. \tag{1.45} $$

On one hand, the dynamical term

$$\sum_i \mathbf{F}^{(a)}_i \cdot \delta \mathbf{r}_i = \sum_j Q_j \delta q_j \tag{1.48}$$

contains the generalized force

$$Q_j=\sum_i\mathbf{F}^{(a)}_i\cdot \frac{\partial \mathbf{r}_i}{\partial q_j}.\tag{1.49}$$

On the other hand, the kinetic term

$$\dot{\mathbf{p}}_i \cdot \delta \mathbf{r}_i~=~ \sum_j{\left[ \frac{d}{dt} \left( \frac{\partial T}{\partial\dot{q}_j} \right) - \frac{\partial T}{\partial q_j} \right] \delta q_j} $$

contains the kinetic energy $T =\frac{1}{2} \sum_i{m_iv_i^2}$.

Specific explanation. It is true that the third edition of Goldstein wrongly says

[...] and the $\color{red}{\it second~term}$ on the left-hand side of Eq. (1.45) can be expanded into $$ \sum_i\left[ \frac{d}{dt}\left[ \frac{\partial}{\partial\dot{q}_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) \right] - \frac{\partial}{\partial q_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) - Q_j \right]\delta q_j. \tag{1.51b} $$

It should have read

[...] and $\color{red}{\it minus}$ the left-hand side of Eq. (1.45) can be expanded into $$ \sum_i\left[ \frac{d}{dt}\left[ \frac{\partial}{\partial\dot{q}_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) \right] - \frac{\partial}{\partial q_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) - Q_j \right]\delta q_j. \tag{1.51b} $$

The second edition does not have the $-Q_j$ term, so an unfortunate mistake was introduced during the update to the third edition. This is not the first time that I have noticed that the second edition is often more carefully written than the third edition in what concerns old material. (The third edition contains a new chapter 11 about classical chaos.)

References:

  1. H. Goldstein, Classical Mechanics; Chapter 1.

You've misinterpreted what Goldstein states:

and the second term on the left-hand side of Eq. (1.45) can be expanded into

To save confusion for some, it could be better expressed as:

and the second term on the left-hand side of Eq. (1.45) can be expanded, so that Eq. (1.45) becomes>

It looks repetitive, so the authors probably stuck with the current form, relying on the understanding of the student to see what is obviously meant. The relevant equations are

$$\sum_i (\mathbf{F}^{(a)}_i - \dot{\mathbf{p}}_i) \cdot \delta \mathbf{r}_i~=~0. \qquad (1.45)$$

$$\sum_i{\mathbf{F}_i \cdot \delta{\mathbf{r}_i}} = \sum_{i,j}{\mathbf{F}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j = \sum_{j}{Q}_j \delta q_j}\qquad (1.48)$$

The second term in equation (1.45) is therefore expanded as in (1.48) and then combined with the expansion for the first term $\mathbf{\dot p}_i\cdot\delta\mathbf{r}_i$ elsewhere , to give $$\sum_j\left[ \frac{d}{dt}\left[ \frac{\partial}{\partial\dot{q}_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) \right] - \frac{\partial}{\partial q_j} \left( \sum_i{\frac{1}{2}m_iv_i^2} \right) - Q_j \right]\delta q_j$$

Note (1.45) is multiplied by -1 so the signs in the expression derived elsewhere for $\mathbf{\dot p}_i\cdot\delta\mathbf{r}_i$ remain the same, hence the $-Q_j$ term rather than $Q_j$. The outer summation is over $j$ and not $i$ as you've put down.

There's a link for correctons to this book if you're convinced you're right, http://astro.physics.sc.edu/goldstein/ although in this case it looks as if it's a misinterpretation on your part.