By Maschke's Theorem, every direct product of representations is decomposable into a direct sum of representations, that is, the function you are integrating can be rewritten as a sum of functions with symmetry properties equal to specific irreducible representations.
As you note, integrating an odd function (which has a certain symmetry, namely antisymmetry with respect to $\sigma_y$, the mirror "plane" of the y-axis) over all space is zero, while integrating an even function (which is symmetric with respect to $\sigma_y$) is generally not. Since integration is linear (that is, the integral of a sum is the sum of an integral), we can consider the integral of each irrep separately.
If the function being integrated is antisymmetric with respect to some symmetry, it will be zero when integrated over all space. The only way for the integral not to be zero is if it is symmetric with respect to all possible symmetries, i.e. it is the totally symmetric irrep.
Expressed in equation form:
$$\int{\prod_{i}\Gamma_i\,\mathrm d\tau}=\int{\sum_j\Gamma_j\,\mathrm d\tau}=\sum_j\int{\Gamma_j\,\mathrm d\tau}$$
and
$$\int{\Gamma}\,\mathrm d\tau=\left\{
\begin{array}{@{}ll@{}}
0, & \text{if}\ \Gamma \text{ contains any odd (antisymmetry)} \\
\text{not necessarily } 0, & \text{otherwise}
\end{array}\right.$$
Then, it is clear that the only time the integral is nonzero is when, amongst the irreducible representations of the direct product (regardless of its dimensionality), the totally symmetric one is present, all other ones integrate out to zero.
I should clarify that when I write the integral of $\Gamma$, I really mean the integral of some awful, complicated looking function that has the symmetry properties of $\Gamma$, which is why I used $\prod$ and $\sum$ instead of $\otimes$ and $\oplus$.
If your question was instead how do you know that the functions with a given antisymmetry really do integrate to zero, let's consider what it means to have a certain symmetry. It means that there is a particular line or plane or point about which the value of the function is redundant. That is, if you specify it on one side, then the value is exactly determined on the other. We are integrating over all space, which means we can choose bounds of integration that utilize this symmetry. This then separates your integral into a non-symmetric piece and a piece using the symmetry. You first integrate over the non-symmetric piece and get something, and then you integrate that over the symmetry-including part. If that symmetry is antisymmetry, as will be the case with at least one symmetry of any irrep other than the totally symmetric one, this will cancel out the non-symmetric part with an equal and opposite non-symmetric part and the whole integral will be zero. Regardless of the dimensionality of the irrep being integrated it has at least one symmetry element over which it can be integrated that is antisymmetric. Hence, only integrals of functions that are totally symmetric are non-zero.
As a basic example, consider your $\int{x\,\mathrm dx}$ integral that you started with. Since this function has a symmetry (namely antisymmetry with respect to $\sigma_y$), I can make the following choice of bounds:
$$\int_{-\infty}^\infty{x \,\mathrm dx} = \int_{-\infty}^0{x \,\mathrm dx}+\int_{0}^\infty{x \,\mathrm dx} =-\int_{0}^\infty{x \,\mathrm dx}+\int_{0}^\infty{x \,\mathrm dx}=0$$
I can choose to integrate only over the nonsymmetric part and then use the symmetry for the rest of space. The presence of symmetry guarantees that I can do that. Remember, the irrep label is just telling you the symmetry properties of some complicated function. If $x$ in the above equation were some function $f$ that I knew nothing about except that is has this symmetry, I could still make this choice of bounds and use this property to get a 0 integral.
EDIT: To address orthocresol's question below:
How does this work for the $E$ set in $C_{3v}$? Let us first think of a function with $E$ symmetry. The $p_x+p_y$ orbitals are such a candidate. Let's consider a top-down view of a $C_{3v}$ molecule. Now, I will consider one of the mirror planes to lie in the $xz$-plane (see Figure 1). I can do this because I can rotate the $p_x+p_y$ ensemble anywhere in the $xy$-plane. That is, there is some linear combination of $p_x+p_y$ such that there is a new set $p_{x'}+p_{y'}$ where the mirror plane lies on the $x'y'$-plane.
Now we set about integrating the upper half plane. Clearly, the half of the negative lobe of the $p_x$ orbital will cancel the half of the positive lobe, leaving only the integral of the positive lobe of $p_y$. Now we consider the lower half plane, the two halves of the $p_x$ lobes cancel again and we have only the integral of the negative lobe of $p_y$. Since the integral of the upper-half plane is the negative of the lower-half plane, the integral over all space is 0.
Now, why was it important to consider $p_x+p_y$ together? This is what allowed us to orient the orbitals with respect to the mirror plane. Consider a $p_x$ orbital alone rotated away from the axis given. It will have no defined symmetries with respect to the plane (reflecting across it will not map the orbital to itself or its negative) and there is no way to rotate it without the $p_y$. This is why they need to transform together in $C_{3v}$. Indeed, the reason why $E$ functions have 0 character under this symmetry is because the $p_x$ got sent to $p_x$ and the $p_y$ to $-p_y$ and so the whole ensemble was sent to $1-1=0$.
Now, hold on you say, can't I use similar arguments to imply that if I integrated a $p_z$ orbital (which is $A_1$ in $C_{3v}$) in all space, I will also get zero. The answer is yes. The $p_z$ orbital is not zero by symmetry in $C_{3v}$. I alluded to this above, the integral of a totally symmetric function in a given point group can still be zero. However, by describing the point group as $C_{3v}$, we are indicating that there is something special about the $z$-axis that breaks the symmetry and therefore precludes coming to this conclusion based on symmetry alone. Consider the deformation of planar $\ce{NH_3}$ to pyramidal $\ce{NH_3}$. In the former ($D_{3h}$), nothing distinguishes the positive $z$ from negative $z$ axis and a $p_z$ orbital is not totally symmetric ($A_2''$) and so we could conclude that it is zero by symmetry. As we pyramidalize to $C_{3v}$ though, the negative $z$ axis becomes different (it's got hydrogens there while the postive $z$ does not) and we can no longer conclude by symmetry that the integral of the $p_z$ orbital will be 0 (indeed, if it mixes even slightly with those hydrogens, it won't be). If it didn't mix though, it's integral would still be 0 (it's still just a $p_z$ orbital), we just couldn't tell that assuming $C_{3v}$ symmetry.