In the Gaussian Quadrature, $x_1,\dots x_n$ are the roots of $p_n$, where $p_n$ is a Legendre polynomial, as usual. With this, why do there exist unique $A_1,\dots A_n$ such that
$$\displaystyle\int_{-1}^1f(x)\,dx=\sum_{i=1}^nA_if(x_i)$$
is exact for $f\in\mathbb{P}_{2n-1}$?
For any choice of distinct evaluation points $x_1,\dots,x_n$, there exist unique coefficients $A_i$ such that the quadrature rule is exact for polynomials of degree $\le n-1$. This follows by considering the linear system $$\sum_i A_i x_i^d = \int_{-1}^1 x^d\,dx,\qquad d=0,1,\dots,n-1$$ which can be solved for $A$ uniquely because the matrix is the Vandermonde matrix, hence nondegenerate.
If $x_i$ are chosen to be the roots of Legendre polynomial, the rule can handle any polynomial $f$ of degree $\le 2n-1$. Indeed, using the long division of polynomials we obtain $f = q p_n +r$ with $q$ and $r$ having degree $\le n-1$. Now,
$$ \int_{-1}^1 f = \int_{-1}^1 (q p_n +r) = \int_{-1}^1 r = \sum_i A_i r(x_i) = \sum_i A_i f(x_i) $$ because the term $qp_n$ contributes exactly $0$ to the integral (by orthogonality of $p_n$ to lower degree polynomials) and to the sum (because that's how we chose $x_i$).