The state of stress at B consisting of normal stress σx and shear stress τxy is shown on a stress element.

Here is Canvas object wihch demonstrate the problem.
Note that the direction of the shear stress is usually determined by inspection. The shear stress on the right face of the element (i.e., +x face) acts in the same direction as the shear force V on the exposed surface on the beam free-body diagram.