Urbanization happens for two main reasons.
In part, it can happen because of bad conditions in the countryside. People might be driven from their homes by wars or famines. They might not be able to find work in the rural areas. This can “push” them away from their homes.
But there are also aspects of cities that “pull” people or attract them to the cities. Usually, these pull factors are economic. Cities tend to be the places where good jobs are the most plentiful. People move to the cities to try to get economic opportunities that are not available to them in the country.