Depends, are you talking our world or a created one?
Even in our world, you've got a not entirely clear picture of religion/churches. In Medieval times, churches and pilgrimages were big business.
To Help the Jews
In Medieval times, Jews were constantly persecuted. At any time, the local lord could decide to throw them all out and seize all their goods. This happened a lot, and included Jewish relics. So if it's a Jewish temple rather than a Christian church (something like in whatever world) this could be a reason. Even Christian churches & clergy were often sympathetic to their Jewish brethren, and at times would help (in secret) keeping them from being killed or helping them move goods. (Some did it for a price as well--helping the Jews for a small remuneration.
To escape religious persecution
Clergy teaching heretical things might fear being excommunicated and their goods being seized by the Knights Templar or by the Pope. They could tunnel and teach in secret.
If, as other posters have noted, war is a problem, you'd want a secret and secure way out before being invaded. The church has the most valuable goods, so it's the first place any invading army would loot.
To avoid the cold
Another, more mundane explanation: weather. Yep. It got cold so they built tunnels to get between cloisters or down to somewhere else they needed to be. There was a mini-ice age, and temperatures dipped, I think it might have been because of a volcano. Back in the day, they didn't have TV, so if they weren't growing food or brewing beer, they were looking for low tech ways to make their lives as priests more comfortable. Besides, digging a tunnel would keep you warm...
Storage and Egress
Yet another on the mundane side: Priests/Monks produced a lot of finished goods. It's actually astounding the amount of money they made, not just from beer, but lots of other products. They have to store them somewhere, and guard against theft. It might be easier to have a direct tunnel out to where a ship would take the goods or a cart.
Actual Smuggling OR Relic Making Factory
Like I said, churches were not so lily white, especially at their height. Whatever reason you can think of for smuggling, it's possible that they did so. Relics, by the way, were HUGE tourist attractions and worth lots of money. There were so very many fakes out there because it was so profitable. So, perhaps this secret area is a place where they carefully made the fakes to sell later. It would be a very big secret/conspiracy at the time. Motives might be to feed the poor with the money or just to make money.