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.
In keeping with this custom we find the term Cardinalis applied at Rome from the end of the fifth century to priests permanently attached to the (twenty-five to twenty-eight) Roman tituli, or quasi-parishes (quasi diæceses), belonging to the church of the Bishop of Rome.
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.
In the course of time and according as the papal headship of the Church manifested itself more and more, the volume of ecclesiastical and temporal business increased greatly at Rome, in consequence of which the popes called in neighboring bishops to represent them at episcopal functions and to aid them with their counsel.
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.