2002: In Nagercoil, a timid 17-year-old Bhavani witnesses his family's murder by his father's rivals. He is forced to take the blame and is incarcerated in a juvenile detention facility, where he is tortured mercilessly. As a consequence, he develops a ruthless and brash persona. Years later, Bhavani is released from the facility and becomes the owner of the lorry and trade business. Gradually, Bhavani becomes a feared gangster and remains immune from punishment by coercing the inmates of the detention facility to take the blame for his crimes. Creating an enormous syndicate for himself, he grows on par with his father's former rivals and eventually kills them.
2019: In Chennai, John Durairaj (J.D) is a college lecturer beloved by his students for his student-friendly approach. He struggles with alcoholism and bitter dislike from fellow staff. Charulatha aka Charu, a newly hired lecturer at his college is the only one who sympathises with him. J.D. decides to uphold an election in the school on a bet with the college principal that stakes his dismissal from the college if the election were to fail. Despite the initial election going successfully, the school came under attack from various goons who were displeased with the result. Since the election finished awry, he is assigned to a juvenile detention facility for a 3-month assignment that he does not remember volunteering for. J.D. reluctantly assumes his new position and is warned by the prison authorities of the rampant drug abuse and violence there, but pays no heed.
Sabari and Manikandan are two brothers, who are supposed to surrender for one of Bhavani's murders. They slip a note to an unaware J.D. and later that night try to call him while he is drunk. When they are caught, Bhavani kills them, and their bodies are discovered hanging from the ceiling of the detention center classroom the next day. J.D. is detained for the murders. A grief-stricken Charu admonishes J.D. for his negligent behaviour, revealing that she was the one who had signed him up for the job, believing him to be the only teacher capable of understanding the needs of the inmates. She reveals herself as an NGO worker investigating the crimes occurring in the facility; the brothers had desperately contacted her for help. While in detention, J.D. discovers the brothers' note, detailing the horrific activities taking place inside the center.
Heartbroken, J.D. clobbers Bhavani's goons who had been dispatched to kill him and calls Bhavani, promising to make him pay for the boys' deaths. Having quit drinking, J.D. slowly gains control over the institution and begins to reform the inmates. His actions are opposed by Das, an older inmate (found to be an adult) responsible for controlling the younger children. With the assistance of a young inmate, Undiyal, J.D. discovers that Bhavani regularly makes the inmates take the blame for his crimes. He records the video of the younger inmates including Undiyal, speaking about Das's crimes in the facility. Bhavani's goons target Charu and retrieve the video from her, sparing her only because of Undiyal's intervention. Undiyal reveals that select inmates are tattooed with the Tamil letter 'рок' (Pa), which allows unrestricted access to free food and drugs from Bhavani's associates in exchange for surrendering for his crimes.
J.D. raids the respective establishments and cuts off the drug supply to the detention facility, much to Bhavani's frustration. He also sneaks into Bhavani's hideout and threatens him and his men with dire consequences, while unknowingly holding Bhavani at knifepoint using a ball pen. Bhavani retaliates by killing some of J.D.'s batchmates and ex-students. With J.D. incapacitated by grief, Das abducts most of the inmates, intending to take them out of Tamil Nadu along with Bhavani's Benami documents. With the help of his friend and expert archer Vanathi, J.D. defeats Das's men and rescues the children. He then confronts Das and makes him realize that Bhavani will kill him because he is the link between Bhavani and the crimes in the detention facility. Das reforms and transports J.D. (along with the kids) to Bhavani's meatpacking plant.
Das is then escorted by Bhavani's goons to a room to be killed, but he overpowers the men sent to kill him while J.D. confronts Bhavani. Although Bhavani initially gets the upper hand, J.D. eventually defeats Bhavani by rendering the latter's right hand unusable for combat. Bhavani later urges J.D. to join him in politics, but J.D. kills him, avenging Sabari's and Manikandan's deaths. With the children safe, J.D. and Das surrender to the police. The detention facility is shut down by the government, with the inmates being sent to other detention facilities and state prisons, based on their age. J.D., Das, and the other adults from the facility are sent to another prison, where they intend to reform the inmates there.