It has become a custom of the Catholic Church to assign a church in Rome to each new cardinal. This is an ancient custom that traces its tradition to the early Church.
Originally the term cardinal was given to priests who were in charge of the parishes in the city of Rome. The Catholic Encyclopedia gives a brief explanation.
As the Church began to expand throughout Europe and the world, the pope needed advisors, bishops in these new areas to consult him on necessary actions. Many of these bishops were then appointed "cardinals" to signify their unique relation to the Roman Pontiff.
Along with being named "cardinal," these bishops were also assigned "titular churches" in Rome to further cement their connection to the Bishop of Rome, the pope.
Practically speaking the cardinal does not participate in the day-to-day operations of the parish, nor does the cardinal have authority to appoint pastors or make major decisions for the parish. In reality, the parish in Rome is more of a second home for cardinals, who are always welcome to celebrate Mass in their titular churches and minister to their spiritual needs.