Anytime you have a group morphism $A\to B$, you get a map $H^*(-;A)\to H^*(-;B)$ for free.
Now that map actually comes one step earlier : it comes from a map $C^*(-;A)\to C^*(-;B)$ (where $C^*(-;M)$ denotes singular cochains with values in $M$); which is simply composition (recall that a singular cochain on $X$ with values in $M$ is a map $C_*(X)\to M$).
Now this is set-up in such a way that this respects the cup-product. Indeed, note that the cup-product is defined using $C^*(X;A)\otimes C^*(X;B)\to C^*(X\times X;A\otimes B)$ and then you can use the diagonal $X\to X\times X$ to land in $C^*(X;A\otimes B)$.
In particular, if $A=B=R$ is a ring, you can compose with $R\otimes R\to R$ (the multiplication map) to get $C^*(X;R)\otimes C^*(X;R)\to C^*(X;R)$.
This, together with Künneth-type theorems, is what buys you the cup-product on cohomology. Now note that all of this is natural and the way the thing is defined, it's actually natural in the ring you're starting from : if $R\to S$ is a ring morphism, then the above construction yields a ring morphism $H^*(-;R)\to H^*(-;S)$.
Now apply this to the ring map $\mathbb Z\to \mathbb Z/2$. This tells you that the natural map $H^*(\mathbb RP^\infty;\mathbb Z)\to H^*(\mathbb RP^\infty;\mathbb Z/2)$ is actually a ring morphism.
But you know that it's an isomorphism in even degrees ! And you also know what $H^0(\mathbb RP^\infty;\mathbb Z)$ looks like.
So what does this tell you ? Well, let's take our generator $x\in H^1(\mathbb RP^2;\mathbb Z/2)$, and look at $x^2$: it lives in degree $2$, and so it has a unique antecedent in integer cohomology. Call this $y$.
Now the fact that our map is a ring map tells you that $y^k\mapsto x^{2k}$ which is a genrator of $H^{2k}(\mathbb RP^\infty;\mathbb Z/2)$. But since it's an isomorphism in even degrees, it follows that $y^k$ is a generator of $H^{2k}(\mathbb RP^\infty;\mathbb Z)$.
Therefore you have a copy $\mathbb Z[y]/(2y), |y|=2$ sitting in $H^*(\mathbb RP^\infty;\mathbb Z)$, and you know that this copy takes into account all the even degrees.
Now presumably you also know that $H^*(\mathbb RP^\infty;\mathbb Z)$ vanishes in odd degrees, so you only have to take care of even degrees, and we've just done that, so we're done.
(if you're not convinced by the argument as written, here's a perhaps more formal way of writing it :
we get our $y$ in degree $2$. This $y$ moreover satisfies $2y=0$. So we automatically get (because the polynomial ring is free) a graded ring map $\mathbb Z[y]/(2y) \to H^*(\mathbb RP^\infty;\mathbb Z)$. This is a graded ring map, and our previous analysis shows that it's an isomorphism in all degrees, therefore it's an isomorphism)