The reason for the attack Sunday morning in Sleman district in Yogyakarta province is not immediately clear.
Churches are a common target for Islamic militants in Indonesia, the world's most populous Muslim nation.
Video shows people in the church throwing books at the man as he lunges towards them with his sword.
Witnesses say the injured include a police officer who tried to subdue the attacker and a priest.
The suspect has been hospitalized.