What made Tom visit the Ewell's house in the first place?
Tom first began visiting the Ewell's house when Mayella called him into their yard to bust up a chiffarobe in exchange for a nickel. After this incident, he would regularly stop by the Ewells' house in passing in order to assist Mayella with small tasks. He did this despite never being paid again because he noticed that Mayella's father and the younger children didn't seem to ever help out with the household chores.
On the day that Mayella was allegedly raped, Tom stops by the house because Mayella claims that a door has come off its hinges. Once she lures him into the house, she instead asks him to lift a box off the top of another chiffarobe. It's at this point that Mayella throws herself at Tom, which leads to a ruckus and the accusation of rape.
I assume that you are asking about the time that he went to the house and Mayella claimed that he raped her. You can find his version of these events in Chapter 19.
According to Tom Robinson, Mayella called him inside the fence and up to the house to help her out. She said that a screen door was falling off its hinges and she wanted him to fix it.
She had often, he said, called him in to help with various things. He always had to pass by the Ewell home to get to the places where he worked for Linc Deas.
According to Tom, she asked him to come on in and help her get something off the top of a chiffarobe on the day in question. She couldn't reach it and claimed she needed his tall reach. However, she had asked him to do many of the chores around the place and she regularly didn't pay him. He claimed he was happy to do these.
Mayella claims on the day in question he was there to bust up a chiffarobe for her. Tom says that he did indeed do this but it was on an entirely different day.