In Germany, if you don't know someone, then it is polite to maintain your distance and respect the person's space. Of course, it also depends what sort of person you are dealing with; young people are often more open than older people. Generally speaking, people do not necessarily become acquainted or make friends on the street, in the park, or at the bus stop.
It's more common for people to get to know each other if they are doing an activity together, at work or in their leisure time. People get acquainted while doing an internship, for example, or participating in a soccer club, at a neighborhood or work party, and these meetings can develop into friendships. In Germany, that sometimes takes a while, but shared interests and liking each other help, and it's worth the effort.