Mammalian sperm cells are required to swim over long distances, typically around 1000-fold their own length. They must orient themselves and maintain a swimming motion to reach the ovum, or egg cell. Although the mechanism of long-distance navigation is still unclear, one possible mechanism, rheotaxis, was reported recently. This work investigates the mechanism of the rheotaxis in detail by simulating the motions of a sperm cell in shear flow adjacent to a flat surface. A phase diagram was developed to show the sperm's swimming motion under different shear rates, and for varying flagellum waveform conditions. The results showed that, under shear flow, the sperm is able to hydrodynamically change its swimming direction, allowing it to swim upwards against the flow, which suggests that the upward swimming of sperm cells can be explained using fluid mechanics, and this can then be used to further understand physiology of sperm cell navigation.