The 22-year-old was arrested in Frankfurt Thursday night and admitted to stabbing the rabbi, Zalman Gurevitch, prosecutors in the city said in a statement. The man is being investigated on suspicion of attempted manslaughter and dangerous bodily harm.
The attack prompted concern and condemnation from local politicians and Jewish groups.
According to the rabbi, the assailant said "I'll kill you, you (expletive) Jew," prosecutors say.
However, prosecutors said the suspect - whose name they did not release - denies having either any intention of killing the rabbi and any anti-Semitic motive.
The Frankfurt-born German citizen, whose parents come from Afghanistan, maintains that he greeted the rabbi with the words "salem aleikum," or "peace upon you." In their statement, they said that there was then "an exchange of words which ended in a physical confrontation."
The suspect said that he "felt physically inferior to the rabbi and so reached for his knife," they added. The weapon had a 7.6-centimeter (3-inch) blade.
Prosecutors said they tracked down the suspect after being tipped off to an Internet forum that contained details of the incident.
Spokeswoman Doris Moeller-Scheu said prosecutors and police had no information to suggest that he had a radical Islamic background. She said the attack appeared to have been spontaneous rather than planned.