Levi Aron, 35, pleaded not guilty in New York City Criminal Court in Brooklyn to first-degree murder and kidnapping in the death and dismemberment of Leiby Kletzky.
Aron was remanded without bail.
Defense attorney Pierre Bazile said Aron "hears voices and suffers from hallucinations." The judge then ordered Aron to undergo a mental-health evaluation, the New York Post reported.
His next court appearance is July 28.
Aron made a full written confession explaining how he smothered the boy and dismembered him, New York Police Commissioner Ray Kelly said.
The 450-word confession allegedly says Aron "panicked" when he first saw child-missing flyers for Levi in the neighborhood -- and panicked again when a "massive search" for the boy had made it to his block.
"When I saw the flyers I panicked and was afraid," he said. "I was still in panic ... and afraid to bring him home. That is when I went for a towel to smother him in the side room. He fought back a little bit."
As the search party got closer, he panicked "because I didn't know what to do with the body," the confession said.
Aron allegedly suffocated the boy with a bath towel, chopped up the body on a cutting board with three knives and stuffed the remains in black plastic garbage bags.
Part of the boy's body was found inside a Dumpster early Tuesday after police tracked Aron down. Other body parts, including the boy's feet, were found inside Aron's freezer.
Aron worked several years ago as a part-time butcher at a Kroger supermarket in Memphis, his ex-wife told The (Memphis) Commercial Appeal.
Police said the way Aron dismembered Leiby showed some proficiency, the New York Daily News reported.
"It looks like he went through the joints, like he knew what he was doing," an investigator told the newspaper.
Police said Leiby was tied up for hours before fighting for his life as Aron allegedly smothered him and then cut up his body.
Police investigated a claim in Aron's confession he took the boy to a wedding in Monsey, N.Y., 40 miles north of New York City, before killing him.
Police said they believe Aron went to the wedding, but do not know if he took the boy with him or left him at his attic apartment, Kelly said.
"We cannot say definitively if the boy was with him or not," Kelly said.
Kate Middleton recycles dress at movie premiere
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'