As Atticus pointed out in his summation to the jury, Mayella committed the offense of tempting a Negro. According to Tom's testimony, she kissed Tom, threw her arms around his waist, and begged him to kiss her, which he refused to do. When her father, Bob, saw them together, he called her a "goddam whore," and threatened to kill her.
"She was white, and she tempted a Negro. She did something that in our society is unspeakable: she kissed a black man. Not an old Uncle, but a strong young Negro man. No code mattered to her before she broke it, but it came crashing down on her afterwards."
This was not something that she, or Bob, was willing to admit in public, so the two of them concocted the story that Tom had raped her, knowing that their word, as white citizens, would be believed over that of a black man. Mayella was probably intimidated by her father, who must have threatened her with further violence if she did not go along with his story. It was probably not the first time that her father had beaten her, and she was afraid to defy him. Although Bob and his family were already "the disgrace of Maycomb County," he knew that admitting the truth would further reduce his stature in the community (if that was possible). Bob hated blacks, and seeing his daughter admit her crime in public was not something he would allow.