A numerical method is developed for solving the 3D, unsteady, incompressible Navier–Stokes equations in Cartesian domains containing immersed boundaries of arbitrary geometrical complexity moving with prescribed kinematics. The governing equations are discretized on a hybrid staggered/non-staggered grid layout using second-order accurate finite-difference formulas. The discrete equations are integrated in time via a second-order accurate dual-time-stepping, artificial compressibility iteration scheme. Unstructured, triangular meshes are employed to discretize complex immersed boundaries. The nodes of the surface mesh constitute a set of Lagrangian control points used to track the motion of the flexible body. At every instant in time, the influence of the body on the flow is accounted for by applying boundary conditions at Cartesian grid nodes located in the exterior but in the immediate vicinity of the body by reconstructing the solution along the local normal to the body surface. Grid convergence tests are carried out for the flow induced by an oscillating sphere in a cubic cavity, which show that the method is second-order accurate. The method is validated by applying it to calculate flow in a Cartesian domain containing a rigid sphere rotating at constant angular velocity as well as flow induced by a flapping wing. The ability of the method to simulate flows in domains with arbitrarily complex moving bodies is demonstrated by applying to simulate flow past an undulating fish-like body and flow past an anatomically realistic planktonic copepod performing an escape-like maneuver.