A member of the church had found the five boys, aged 14 to 18, in the southern town of Sävsjö on Thursday, Christmas Eve, local pastor Jonas Nyström told AFP.
Nyström said the police had asked the local Högland parish to look after the teenagers until the social services opened on Monday following a Christmas break.
"They were cold, they were tired and they were starving," Nyström said.
The group had been "abandoned in the forest by a smuggler who did not want to be seen with them, and they were able to get to Sävsjö by following a railway line," he said.
A Swedish radio report said they had travelled across Europe hidden in a container.
Nyström said the Afghans did not speak English and he had communicated with them using translation software and through other Afghans in Sweden.
"Some of their parents had been killed by the Taliban," he said.
Many Afghans use illegal people smugglers to flee their dangerous and destitute country, with Europe the main destination.