Animal movements result from a complex balance of many different forces. Muscles produce force to move the body; the body has inertial, elastic, and damping properties that may aid or oppose the muscle force; and the environment produces reaction forces back on the body. The actual motion is an emergent property of these interactions. To examine the roles of body stiffness, muscle activation, and fluid environment for swimming animals, a computational model of a lamprey was developed. The model uses an immersed boundary framework that fully couples the Navier-Stokes equations of fluid dynamics with an actuated, elastic body model. This is the first model at a Reynolds number appropriate for a swimming fish that captures the complete fluid-structure interaction, in which the body deforms according to both internal muscular forces and external fluid forces. Results indicate that identical muscle activation patterns can produce different kinematics depending on body stiffness, and the optimal value of stiffness for maximum acceleration is different from that for maximum steady swimming speed. Additionally, negative muscle work, observed in many fishes, emerges at higher tail beat frequencies without sensory input and may contribute to energy efficiency. Swimming fishes that can tune their body stiffness by appropriately timed muscle contractions may therefore be able to optimize the passive dynamics of their bodies to maximize peak acceleration or swimming speed.