The effect of an upstream bluff body on energy harvesting performance of a heaving and pitching hydrofoil is investigated numerically using a two-dimensional immersed boundary method at . The presence of the upstream body changes flow structure around the hydrofoil and enhances efficiency significantly by two mechanisms. Mutual interaction of the vortex shed from the upstream body and the leading-edge vortex of the hydrofoil precipitates the separation of the leading-edge vortex from the hydrofoil and its streamwise transport. The incoming flow deflected by the upstream body changes the effective angle of attack for the hydrofoil. These phenomena significantly increase heaving force and pitching moment during stroke reversal, and major contribution to efficiency enhancement is from the change in pitching moment. 30% increase in efficiency, relative to a hydrofoil without an upstream body, can be achieved for same kinematics. However, the upstream body may be disadvantageous in some configurations. If the hydrofoil is placed closely to the body in transverse direction, the leading-edge vortex formation is suppressed after stroke reversal. When flapping frequency does not match with vortex shedding frequency of the upstream body, non-periodic flow structure formed around the hydrofoil can cause efficiency drop and irregular power generation.