Interesting question! They're almost interchangeable as they're both about having knowledge, but..
- أعرف (from the noun معرفة = knowledge) leans more toward recognizing familiarity and identifying things (in this case a city) or people. "I know you from somewhere, don't I?!" "I know the names of all US presidents by heart!"
and if you inflate the verb further it becomes أعترف which is to acknowledge or admit something and the noun تعريف = definition
while..
- أعلم (from the noun علم = education, science) is more along having a deep understanding of something. A scientist is a عالِم and teaching/educating is تعليم, while the plural form تعليمات is instructions. A piece of information/trivia is a معلومة
Hope knowing more about what the two verbs come from and inflate into helps you judge for yourself which is better to use when.
A: Who is that guy?
B: I don't know him. لا أعرفه
A: Well why's he on a horse?!
B: I don't know! لا أعلم