This study extends the existing immersed boundary method (IBM) in the open source toolbox OpenFOAM for solving fluid-structure interactions involving the immersed structure with changeable shapes. To handle a changeable-shape problem, the existing discrete-forcing direct-imposition approach of IBM in OpenFOAM with a pressure-implicit split-operator (PISO) solver is used to solve the fluid domain with interpolated immersed boundary conditions. In the solved fluid domain, the interactions between the fluid domain and the immersed structure are calculated. Making use of these interactions, a user-defined solid solver is applied to compute and update the boundary conditions on the immersed structure. To validate this methodology, models of anguilliform swimming, a typical FSI problem with moving boundaries which has been well studied, is simulated. The accuracy of the present work is examined by comparing the numerical results with the published data. In simulations, anguilliform swimmers are modeled as deformable immersed boundaries. The immersed swimmers propagate in a path determined by the forces from the surrounding fluid acting upon their bodies, as generated by their prescribed changing shapes. The results including the velocity, the thrust, the wake morphology, and the force distribution along the immersed boundaries are presented and discussed. The good agreement of the computational results with reported works validates the extension of IBM in OpenFOAM.