Consider a man walking on a rough ground towards the east. If this was the case, the friction should have acted towards the opposite direction, i.e., west. Instead in real life, in the same case, the friction acts in the same direction as that of motion, i.e., east. How?
There are two frictional forces acting. You exert a frictional force on the ground, and the ground exerts an equal and opposite frictional force on you.
The frictional force that the ground exerts on you points east so it accelerates you eastwards. That's why you move east.
The frictional force you apply to the ground points west so in principle it accelerates the whole Earth westwards, though in practice the mass of the Earth is so large that any acceleration you impart to it is immeasurably small.
I am guessing that you're thinking that the friction by the ground should oppose the motion of the object moving on it, in our case the walking man.
But friction is what exists between surfaces, not objects, and in our case the two surfaces between which friction is acting are the man's feet/footwear and the ground.
Try walking right now (slowly), and observe what your feet are doing as you move forward. When you step forward, you swing your leg ahead and place your foot on the ground, and using it as a pivot you move your body ahead. In this action of moving ahead, you're also pushing the ground behind you(something that you cannot do on a slippery surface).
Therefore, the surface in question that is in contact with the ground actually wants to move backwards, which is obviously counteracted by the friction from the ground as a resistance to the relative motion of the surfaces.
So when moving east, the surfaces of the feet have the tendency of moving west(backwards) when in contact with the ground, which is opposed by the friction from the ground acting towards east, with the help of which we anchor our feet and continue walking.