I think a better question might be "Why hadn't he asked it before?" To which of course Tyrion himself answers something like
I knew the answer before I asked. Eighteen years since Jaime joined the Kingsguard, and I never once raised the issue. I must have known.
Why does he ask it now? In the books, he is just barely recovered from the wounds he received in the battle of the Blackwater, and in the assassination attempt performed by Ser Mandon Moore of the Kingsguard. It is possible that his brush with death, his belief Cersei tried to kill him, his father's ingratitude, the unfairness of what people think of him, etc. makes him throw caution to the wind and once and for all ask the question he has been dreading to ask for the bigger part of his life. And of course, it turns out he was right in being afraid.
There is nothing in the books that indicates that he had a specific reason for asking. It is portrayed as a spur of the moment kind of thing:
Tyrion rose on unsteady legs, closed his eyes for an instant as a wave of dizziness washed over him, and took a shaky step towards the door. Later, he would reflect that he should have taken a second, and then a third. Instead he turned.
"What do I want, you ask? I’ll tell you what I want. I want what is mine by rights. I want Casterly Rock."