Direct numerical simulations are used to study the laminar to turbulent transition of a Mach 2.9 supersonic flat plate boundary layer flow due to distributed surface roughness. Roughness causes the near-wall fluid to slow down and generates a strong shear layer over the roughness elements. Examination of the mean wall pressure indicates that the roughness surface exerts an upward impulse on the fluid, generating counter-rotating pairs of streamwise vortices underneath the shear layer. These vortices transport near-wall low-momentum fluid away from the wall. Along the roughness region, the vortices grow stronger, longer and closer to each other, and result in periodic shedding. The vortices rise towards the shear layer as they advect downstream, and the resulting interaction causes the shear layer to break up, followed quickly by a transition to turbulence. The mean flow in the turbulent region shows a good agreement with available data for fully developed turbulent boundary layers. Simulations under varying conditions show that, where the shear is not as strong and the streamwise vortices are not as coherent, the flow remains laminar.