Dynamic models are a cornerstone of power system stability and control. The growing penetration of inverter-based resources, driven by global decarbonization, significantly complicates power system dynamics. For large-scale power systems, existing dynamic models of these resources have long struggled to accurately capture their complex behaviors, limited primarily by explicit formulations based on simplified physical governing equations. This study presents a data-driven modeling approach that uses neural networks to learn and represent these dynamics exclusively from accessible data. Its tailored architecture combining long short-term memory network for temporal dependencies with a cross layer to model nonlinear feature interactions. Physical constraints from an inverter dynamic model are enforced to enhance consistency and prevent implausible outputs. Validated on a real-world power system (including a wind farm, a photovoltaic power station, and a grid-forming battery energy storage station), the proposed model shows superior accuracy and extrapolates across out-of-distribution scenarios. These findings are further confirmed in a large-scale power system and an inverter-dominated system. The presented approach provides an effective methodology to capture and simulate complex inverter dynamics, enabling more reliable transient stability assessment crucial for the secure operation of future grids.