“knew where they were going.”a It is not that the people “recognized them.” Jesus had just been with them. They knew both Jesus and the apostles well. And, had they been sensitive at all, they also would have known why he was leaving—to get some privacy. But they were selfish, and knowing where he would go to be alone, got there before he did.
“from all the cities.” This is hyperbole to emphasize how many cities were involved.
“arrived before them.” This, and the start of verse 34, which is translated in many versions as “came ashore” or something similar, creates a contradiction with John 6:3-5. The crowd was not waiting on the shore for Jesus. If it were, he would have seen the people long before he came ashore. John makes it clear that the crowd, even if it was ahead of Jesus and the group with him for a little while, eventually lagged behind. Thus, Jesus arrived with his disciples on the shore and spent some time with them before the crowd assembled. Jesus “came out” of his retreat and saw the multitude assembled, and had compassion on them.