The present study focuses on formulating a fluid–structure interaction (FSI) framework by coupling a finite element analysis (FEA) based structural solver and a lumped vortex method (LVM) based potential flow solver to study the coupled dynamics involved in the undulatory and oscillatory swimming of fishes. The caudal fin of a carangiform fish is modelled as a continuous cantilever beam with a periodic support motion. The effect of the actuation frequency on the thrust coefficient is investigated. A significant increase in the aerodynamic thrust is noticed for the support motion frequencies nearing to the structural natural frequencies of the beam. Next, the whole fish body, considering the full-body undulations, is modelled as a continuous free-free beam. This model incorporates a time-dependent actuating moment varying along the length of the body which can be attributed to the muscle moments generated by the fish. A parametric study is carried out to obtain maximum thrust output for the muscle power input in terms of the actuation moment. It is observed that the generated thrust increases significantly when the frequency of the actuation moment approaches towards the natural frequencies of the free-free beam. A comparative study of the average thrust coefficient is carried out for these two cases. © 2021, Springer Nature Singapore Pte Ltd.