According to Atticus, Mayella was motivated to lie in order to rid herself of guilt. What rigid code of her society did she break?
The pitiful Mayella Ewell is certainly one of the most sympathetic characters in Harper Lee's To Kill a Mockingbird. Mayella was the oldest of Bob Ewell's children, and following the departure of her mother, Mayella was left to serve as the family's surrogate mother. She had no friends or money and no social life. She was so desperate for human interaction that she invited Tom Robinson--a married African-American man--into her home under the pretense of helping her with moving a chiffarobe (chest of drawers). Her true intention was to somehow gain his affections, but when she threw her arms around him and kissed him, Tom bolted from the house. This was the "code of society" that she violated: Whites and blacks rarely mixed socially in Depression era Alabama, and any kind of physical or sexual contact between different races was taboo. So, instead of admitting the truth, she decided to claim (no doubt prompted by her guilty and ashamed father) that Tom attacked her.
During Atticus' closing remarks, he mentions that Mayella Ewell felt guilty for breaking a rigid, time-honored code of their society. The time-honored code that Atticus is referring to concerns the taboo surrounding interracial romance in the Deep South. In 1930s Alabama, it was considered taboo for a white woman to have relations with an African American man. Interracial couples were ridiculed and ostracized by racist citizens throughout the Deep South. Mayella Ewell felt guilty after she was caught by her father making advances towards Tom Robinson. After Bob Ewell had beaten his daughter, Mayella found it necessary to accuse Tom Robinson of assaulting and raping her in order to save her reputation and get rid of her guilt. Atticus comments on Mayella's guilt and says that the only way to remove Tom Robinson from her presence was to falsely accuse him.