A criminal attorney will represent you if you are charged with a crime. A civil attorney will represent you in a civil suit against individuals or corps; e.g. medical malpractice. A divorce lawyer will represent you in a divorce to ensure you receive a fair portion of the marital property. A tax lawyer will help you with tax codes.
There are litigation lawyers, family lawyers, real estate lawyers, probate lawyers, civil lawyers, bankruptcy lawyers, defense lawyers, immigration lawyers. You can pretty much get a lawyer for any problem.