It depends on the context.
If someone says, "I knew that she had been to Japan", then I can ask only, "How did you know that?"
In the following dialogue, either form is possible.
A: My son is in the capital of Mongolia - I forget the name of the place.
B: It's Ulan Bator.
A: How did/do you know that?
Student or Learner