It is not known exactly when, where or why Adelaide earned the nickname of City of Churches. It is believed to have been in use since before 1872, when the term was quoted by English novelist Anthony Trollope in his book Australia and New Zealand.
The state of South Australia (of which Adelaide is the capital city) was the only one in Australia founded purely by free settlers. These free settlers had strong traditions of religion which they brought with them from their own countries, and particularly, the freedom to practise their own religion and form of worship: this was especially the case for the German settlers. Many large and beautiful churches were built in and around Adelaide, and still stand today. The churches are the oldest buildings in Adelaide; among them, Holy Trinity Anglican Church on North Terrace (1838) and the Quaker Meeting House in Pennington Terrace (1840). More than anywhere else, Adelaide churches seem to have reflected the different architectural styles through the years, and because many of these included gothic styles with high spires, even today they tend to dominate the city's skyline.
Another quirk of South Australian settlement which led to the "City of Churches" tag was that religious groups of any denomination were allowed to be granted a city acre plus a parcel of non city land (some sources claim about 40 acres). Given the size of city blocks this made for a large number of sites. Different religious groupings within the same church were also eligible for the grants. The land could be used for any purpose but it was primarily used for building churches. This was largely because of the high population density in the city. The non city land tended to be used to endow schools or other religious establishments (eg St Peters boys school, Price Alfred College, the Passionist monastery on Cross Road etc).
Related Q&A:
Why is Adelaide known as the City of churches?-Well, Adelaide is known as the City of Churches for a bunch of reasons. You know, it has a long history and was founded by people with strong religious beliefs. Over time, many different churches were built here. Also, the religious influence is quite significant in the community. There are all kinds of churches, from big and grand ones to smaller, more intimate ones. It's just part of the city's identity and charm. When you walk around Adelaide, you can't help but notice them everywhere. So, that's why it got that nickname.