Aquatic animals have evolved diverse swimming techniques. They have demonstrated abilities to harness energy from vortices, particularly the Kármán vortex street, resulting in enhanced thrust. However, gaps remain in comprehensively understanding the factors influencing this increased thrust and the specific hydrodynamic characteristics involved. In this study, we studied an undulating foil downstream a circular cylinder to further understand the flow control mechanism involved in optimizing energy capture from hydrodynamic disturbances. We utilised numerical simulations with a moving adaptive mesh in laminar flow. We found that the leading vortex and secondary vortex at the foil's leading edge, originating from the Kármán vortex, played a crucial role in thrust enhancement. The undulating foil was more efficient in capturing energy from the Kármán vortex street than a stationary foil. When the foil was nearer to the cylinder, the energy capture was more evident, leading to intricate vortex patterns and easier leading vortex and secondary vortex generation. The foil's lift initially rose with closer proximity but decreased with increased distance. Our results showed that for minimal drag and optimal lift, the cylindrical body's position is closely tied to the interaction between the Kármán vortex street and the undulating foil. These insights can be applied in applications of designing efficient propulsion systems for underwater vehicles and optimising energy harnessing mechanisms in marine environments.