The Attorney General is like the boss of all lawyers who work for the government. They are the top lawyer for the whole country or state. Just like how your teacher is in charge of your classroom and makes sure everyone follows the rules, the Attorney General makes sure everyone follows the laws for the whole country or state.
Their job is to give legal advice to the President or Governor and other government leaders. They also represent the government in court cases, and make sure that people who break the law are punished.
Think of it this way, if you were playing a game with your friends and someone cheated, the Attorneys general would be the one in charge of making sure they were punished so that everyone would know that cheating is wrong. They are like the referee of the game of laws.