The suspect, taken into custody in a mental institution late Tuesday, has a lengthy record of rape and other convictions, Police Commissioner Charles Ramsey said on NBC's "Today."
The victim was treated and released from a hospital.
Ramsey criticized other riders for standing by when the assailant entered the train with his 5-year-old son, directed the boy to a seat, calmly pulled a hammer from a backpack and attacked a man dozing in a nearby seat.
At least 10 other riders were in the car when the attack occurred last week, yet no one interfered as the man repeatedly struck the victim in the train car and later out on a platform, Ramsey said on "Today."
"They better pray they're never a victim, because if someone was attacking them that way they would certainly hope someone would step forward and help, and it starts with stepping forward and doing something yourself," Ramsey said.
Police had asked the public to help identify the attacker and released surveillance video showing the early Sept. 4 attack that was played repeatedly on Philadelphia television stations.
Police said the man was apprehended after family members called police. Ramsey did not identify the man or say whether he had been charged yet, but said he had a lengthy record.
"He has a long criminal history including rape, robbery, assault, narcotics violations," Ramsey said.
The suspect apparently had tried to hurt himself with the hammer following the attack on the subway. Family members said they were not initially aware of the attack, but had the suspect committed to the mental institution where he was taken into custody.
The victim, 20-year-old Dewayne Taylor, made his own way to a hospital and was treated for head and neck injuries. Taylor, who has been released from the hospital, said Tuesday he has no idea who the attacker is or why he was targeted.