Yes, it is generally considered polite to say hello back when someone greets you, even if you don't know who they are. Responding with a simple and friendly "hello" or "hi" acknowledges their greeting and shows that you are approachable and courteous.
If you are in a situation where you're not sure if you know the person or if you have forgotten their name, you can also add a friendly tone and say something like, "Hello! I'm sorry, I don't think we've met before. I'm [your name]." This approach helps initiate introductions and allows the other person to introduce themselves if they wish.
By responding to the greeting, you create a positive and friendly atmosphere, which can lead to further interactions and potentially help you establish new connections or friendships. It's always better to err on the side of politeness and acknowledge the other person's presence, even if you're not sure of their identity.