The 28-year-old, an avid Manchester United supporter, explained why he always tries to sign autographs after Keane refused him the same privilege years ago.
A video of McIlroy handing a ball to a wide-eyed boy at the British Masters has gone viral.
And speaking ahead of the Alfred Dunhill Links Championship at St Andrews, McIlroy revealed why he takes time out to acknowledge young fans.
"I was sort of surprised how that little moment last week became such a big thing because it's quite a regular occurrence on Tour," he said. "I must use between six and nine balls a round, and every time I need a new one, I look for a young kid in the crowd in between holes to give it.
"It just shows what such a small thing can mean to a kid. I had it go the other way for me, where I asked someone for an autograph as a kid and they didn't give it to me. I've never liked them since. It was Roy Keane, who should be one of my heroes.
"I asked for his autograph at the Portmarnock Links Hotel when he was with the Ireland squad and he said no. It sort of stuck with me. That's why, if a kid asks for an autograph, I always try to do it."