A finite element approach is suggested for the modeling of the dynamics of multivariant martensitic phase transitions (PTs) in elastic materials at the nanoscale in the three dimensional (3D) case. The model consists of a coupled system of the Ginzburg-Landau equations for transformation strain-related order parameters and dynamic elasticity equations. Thermodynamic potential [V. Levitas and D. Preston, Phys. Rev. B 66, 134206 (2002)] that captures the main features of macroscopic stress-strain curves is used. The evolution of multivariant microstructure in a 3D specimen for cubic to tetragonal PT in a NiAl alloy is modeled with dynamic and static formulations. The numerical results show the significant influence of inertial forces on microstructure evolution.