> Why is loitering a problem?
Are you pretending to be a space alien unfamiliar with how crime works on Earth? OK, let me spell it out for you.
Various forms of crime require previous periods of observing the target. For example, if you want to rob a shop, you want to know how many employees are inside, whether most of the leave at a certain time for a lunch and leave one of them in the shop alone, whether they leave together at evening or again one of them stays behind and closes the shop. Similarly, if you want to assault a person, you wait until you find someone walking alone, and make sure that the rest of the group is not walking a few meters behind them. If you sell drugs, you need to stay on the street, waiting for the customers to approach you. etc.
On the other hand, there are almost no good reasons to stand for one hour in front of the shop, observing what goes on inside. There are almost no good reason for a group of adult men to stand in front of a school at evening. Etc.
I am not saying that anyone who stands at a weird place should be immediately arrested. But it makes sense for other people to be concerned about that, and call the cops, who will ID the people who stand there, and tell them to go away. Which they cannot do if standing there is perfectly legal. Hence, the "crime" of loitering.