The immersed boundary and large eddy simulation methods are combined to study the propulsion and energy harvesting performances of a wave glider based on a flapping foil. The heaving and pitching motions are actuated by the wave and external power, respectively. The propulsion and energy harvesting performances for different wave heights, pitching amplitudes, and reduced frequencies are investigated. It is found that the propulsion performance in the upstream direction increased with the increase of wave height and reduced frequency. However, it decreased with the increase of pitching amplitude. Moreover, the propulsion performance in the downstream direction and the energy harvesting efficiency all increased with the increase of pitching amplitude or decrease of reduced frequency when the wave height is near the chord length of the foil. The time-averaged propulsion coefficient of 2.92 and energy harvesting efficiency of 44.75% are obtained at a pitching amplitude θ0 = 80° and reduced frequency f ∗ = 0.15. The results suggest that the oscillating foil can act as a propeller and an energy generator when the wave glider is traveling downstream. However, the oscillating foil can only act as a propeller when the wave glider is traveling upstream.