Arya and the Hound were planning to stride right into King's Landing, but they were briefly stopped by a Northern guard before the duo breezed past him on their way. However, how did they get into the city? At that point, King's Landing was locked down and fortified; the gates and walls were lined with Lannister soldiers prepared for a siege. Tyrion even recruited Davos Seaworth, "the greatest smuggler alive", to sneak his brother Jaime into the city after Tyrion freed him from captivity. Yet somehow, Arya and the Hound - the latter of whom is well known in the realm - were able to penetrate the city's defenses and stroll right into the Red Keep along with the masses seeking refuge.
They were somewhat disguised as civilians and probably blended into the crowd. The gates would be shut last minute and only be heavily guarded as we saw for the gates into the Red Keep. It’s likely commoners from the surrounding lands and farmlands were still flocking in for as long as possible to be safe inside the city.