Because belonging to the church (being a church official such as a priest or a bishop) esentially meant you were given education (not common or at all present in those times) and a good position with a pay. You also exerted a lot of power in your local or regional community as church officials were considered to have been influential figures in medieval ages.