Loffley's lawyer Roger Chambers said Loffley denied killing JJ.
"He is a person that acknowledges that from time-to-time he has been violent to others ... But he says that on this occasion 'it wasn't me' - that is the essence of his plea. The police have got the wrong person," he said.
Crown prosecutor Phil Hamlin said Loffley had been violent towards JJ and his mother since they started living together last May and had been ordered by the court to go to anger management classes as a result.
He said JJ had a short and violent life and was frightened of Loffley.
"Mr Loffley was alone caring for JJ when he became angry and frustrated with the young boy [and] struck JJ in the stomach with such a powerful blow that ... within minutes that boy was dead. Mr Loffley pretended all was well with JJ and told the child's mother that the boy had fallen off the bed. He placed JJ in bed and said good night to him. JJ was dying but, oblivious to this, his mother watched a movie in the room next door."
Loffley then went to the shops and a friend's place with his brother - who also lived at the house. He came home to "find" JJ not breathing and carried him downstairs to the lounge.
Minutes later electrician Roger Lang arrived at the house, sent by Housing New Zealand to replace smoke alarm batteries.
"I saw the boy lying down on the rug. I knelt down beside him ... I just got straight into it," he said.
He said no one in the house was doing anything to help JJ.
"There was absolutely nothing going on ... There was no movement - apart from the chest rising or falling from my breaths ... I could hear talking about getting smokes, wailing and a bit of crying."
Paramedics arrived and pronounced JJ dead.
Loffley later told police investigating the death that JJ had fallen off a bed, landed on his head and was "winded and dazed" for a few minutes, then fine.
But a pathologist determined JJ died as a the result of a non-survivable injury caused by a "significant force". A blood test showed cannabis in his system.
The trial continues today.