The types of prisons for adults depend on the country that the prison is located in. For example, the United States has 6 categories of prisons. They are minimum secruity, medium security, close security, maximum security, supermax, and federal. Conversely, Scotland only has three types of prisons for its inmates. They are low, medium, and high supervision.
Because your question specifically mentions four types of prisons, I will assume that you are asking about the four types found in England and Wales.
The four types are named A, B, C, and D. Types A, B, and C are all "closed" prisons and type D is an "open" prison. Open prison means that the inmates are under minimal supervision and perimeter security. The inmates are also not likely to be locked up in prison cells and can often seek employment during their incarceration.
Closed prisons (types A, B, and C) have much tighter security. Whether an inmate is in type A, B, C, or even D depends on a combination of the crime committed, the length of the sentence, the likelihood of escape attempts, and the danger to the public if a successful escape occurs.
Type A prisons are for prisoners whose escape would be very dangerous to the public or national security. Crimes associated with these inmates typically are murder, rape, robbery, drug trafficking, and/or terrorism.
Type B prisons are for prisoners who do not require the high security of type A prisons, but who are still escape risks and a danger to the public if they do escape.
Type C prisons are for inmates who are not likely to attempt an escape, but cannot be trusted in open conditions like a type D prison offers.