Lawyers have to, in much the same way that doctors have to with the human body, specialise in the various sections of law. Doctors have paediatricians and obstetricians, while lawyers have criminal defence lawyers and civil dispute lawyers (which breaks down even further too).
The reasons for this specification are the same in both professions; the areas of study are just to large for any individual to gain a full grasp of any of them, let alone all of them. Thanks to this specialisation we end up (as users of the legal system), with better informed lawyers who are therefore better able to provide effective legal assistance.
Specialisation in the legal profession is actually very wide, even when you compare it to others. You don’t just have lawyers who work with civil law; civil lawyers can work with; corporate law and litigation between businesses or businesses and individuals; neighbour disputes; reviewing contract details; compensation, and much more.