What did Ramanujan get wrong?
Bruce Berndt writes,
Most of Ramanujan's mistakes arise from his claims in analytic number theory, where his unrigorous methods led him astray. In particular, Ramanujan thought his approximations and asymptotic expansions were considerably more accurate than warranted. In [12], these shortcomings are discussed in detail.
[12] is Berndt, Ramanujan's Notebooks, Part IV.
Hardy wrote some things about this, as I learned when writing this blog post. Here is a mistake which was even featured in the Ramanujan movie: in his letters to Hardy, Ramanujan claimed to have found an exact formula for the prime counting function $\pi(n)$, but (in Hardy's words)
Ramanujan’s theory of primes was vitiated by his ignorance of the theory of functions of a complex variable. It was (so to say) what the theory might be if the Zeta-function had no complex zeros. His method depended upon a wholesale use of divergent series… That his proofs should have been invalid was only to be expected. But the mistakes went deeper than that, and many of the actual results were false. He had obtained the dominant terms of the classical formulae, although by invalid methods; but none of them are such close approximations as he supposed.
Based on the second sentence in particular it sounds like what happened, although I haven't checked, was that Ramanujan's formula was the explicit formula but missing the contribution from the complex zeroes of the zeta function.