It's a fan theory that the Mad King raped Tywin's wife Joanna, and Tyrion was the result.
It's a shaky theory that ignores most of the other themes of Tyrion being more like his father than either would care to admit, and actually would apply more to Jaime / Cersei as they were born earlier and there is a bit of the books that alludes to the Mad King getting 'carried away' during the bedding ceremony part of Tywin and Joanna's wedding.
Also if Tywin suspected Tyrion wasn't his, he would have had no problem killing him, something he explicity says to Tyrion in the show.