Numerical simulations of complex subsurface flow problems and geomechanics will advance enormously by dynamic adaptive gridding. Only a small part of a large domain where sharp changes occur may require fine gridding. In this work, we introduce a methodology to carry out dynamic adaptive gridding for large-scale flow problems. The algorithm allows 2D and 3D unstructured gridding with consideration of full fluid compressibility in single-phase, and two-phase compositional flow. We divide a triangular element into four and a tetrahedron element into eight which creates hanging nodes at each level of refinement. The handing nodes are eliminated by splitting extra elements. As a result, a transition region exists between the fine and coarse grid regions of the domain. We have applied the method to CO2 sequestration in subsurface aquifers. The conditions are selected such that gravity fingers develop from density increase by the dissolution of CO2 in the aqueous phase. The selected examples include large domains where neither systematic studies nor dynamic adaptive gridding have been reported in the past. Results from comparison with uniform gridding reveal a speedup of up to three orders of magnitude in 3D.