In a nutshell, your piecewise function is not well approximated by a linear combination of the first 5 Legendre polynomials. The other test functions, sinh, exp, etc are well approximated, so you get excellent agreement.
Here are some supporting calculations. At first, I duplicate your work by defining the 5 Gauss points and their weights.
z = {0,
Sqrt[5 - 2 Sqrt[10/7]]/3,
-Sqrt[5 - 2 Sqrt[10/7]]/3,
Sqrt[5 + 2 Sqrt[10/7]]/3,
-Sqrt[5 + 2 Sqrt[10/7]]/3}
w = {128/225, (322 + 13 Sqrt[70])/900, (322 + 13 Sqrt[70])/900,
(322 - 13 Sqrt[70])/900, (322 - 13 Sqrt[70])/900}
Next I define a few of your functions and pick one to use. So far nothing new or interesting.
g1[x_] :=
Piecewise[{{3600 (1 - 4 x)^4,
1/5 <= x < 1/4}, {225 (1 - 18 x + 61 x^2)^2, 0 <= x < 1/5}}, 0]
g2[x_] :=
Piecewise[{{230400 (-1 + 4 x)^2, 1/5 <= x < 1/4}, {900 (-9 + 61 x)^2,
0 <= x < 1/5}}, 0]
g3 = Sin[Cos[#] Exp[#]] &;
g = g2;
max = Ceiling[FindMaximum[{g[x], 0 <= x <= 1}, {x, 0, 1}][[1]]];
min = Floor[FindMinimum[{g[x], 0 <= x <= 1}, {x, 0, 1}][[1]]];
NIntegrate[g[x], {x, 0, 1}]
Plot[g[x], {x, 0, 1},
PlotRange -> {Automatic, {min, max}}]
To try different test functions, change g=g2 in the above to g=g1 or g=g3, etc. Now I re-scale the function g[x] which has domain (0,1) to h[y] with domain (-1,1).
h[y_] := g[(y + 1)/2]
NIntegrate[h[y]/2, {y, -1, 1}]
Plot[h[y], {y, -1, 1},
PlotRange -> {Automatic, {min, max}}]
Finally, I fit the first 5 Legendre polynomials to the function h[y]. Gaussian integration finds the integral of the curve fit by sampling the function at just 5 points. I also plot the curve fit and h[y] to see how good is the fit. For your piecewise functions, it is not too good, which leads to the discrepancies in the integrals.
poly = Table[LegendreP[k, y], {k, 0, 4}];
coef = {a, b, c, d, e};
f[y_] := Evaluate[coef.poly];
s = Solve[Thread[f /@ z == h /@ z], coef] // Flatten;
fit[y_] := Evaluate[f[y] /. s]
NIntegrate[h[x]/2, {x, -1, 1}]
NIntegrate[fit[x]/2, {x, -1, 1}]
gaussResult = w.(h /@ z)/2 // N
Plot[{h[y], fit[y]}, {y, -1, 1},
PlotRange -> {Automatic, {min, max}},
PlotStyle -> {{Blue}, {Red, Dashed}}]
We have seen 4 ways to calculate the integral. One is NIntegrate[g[x], {x, 0, 1}]. A second is NIntegrate[h[x]/2, {x, -1, 1}]. These two methods give the same results, because its the same function, just re-scaled.
The third method is to integrate the curve fit, NIntegrate[fit[x]/2, {x, -1, 1}] and the fourth is to sample the h[y] at the 5 gauss points, as w.(h /@ z)/2 // N. These two methods will agree with each other, but will not be the same as the first two methods, unless the curve fit is very close. We might note that the curve fit is exact at the Gauss points.