Inspired by the energy harvesting eel, a flexible flag behind a D-shape cylinder in a uniform viscous flow was simulated by using the immersed boundary method (IBM) along with low-speed wind tunnel experimentation. The flag in the wake of the cylinder was strongly influenced by the vortices shed from the upstream cylinder under the vortex-vortex and vortex-body interactions. Geometric and flow parameters were optimized for the flexible flag subjected to passive flapping. The influence of length and bending coefficient of the flexible flag the diameters (D) of the cylinder and the streamwise spacing between the cylinder and the flag, on the energy generation was examined. Constructive and destructive vortex interaction modes, unidirectional and bidirectional bending and the different flapping frequency were found which explained the variations in the energy of the downstream flag. Voltage output and flapping behavior of the flag were also observed experimentally to find a more direct relationship between the bending of the flag and its power generation.