The police arrested the man and the situation was controlled, said reports.
Panic gripped as the man started attacking people near the community kitchen, or Guru Ram Das langar, where devotees and locals were present.
People inside the temple complex overpowered the attacker and his aide before they were arrested.
The injured were shifted to a hospital.
According to the police, the accused conducted a recce of the area before the attack.
"The second accused allegedly conducted recce along with the one who attacked devotees," a police officer told reporters.