Recent advances in data sensing and processing technologies enable data-driven control of high-voltage direct-current (HVDC) systems for improving the operational stability of interfacing power grids. This paper proposes an optimal data-driven control strategy for an HVDC system with linecommutated converters (LCCs), wherein the dc-link voltage and current are optimally regulated at distinct HVDC terminals to improve frequency regulation (FR) in both rectifier-and inverter-side grids. Each HVDC converter is integrated with feedback loops for regulation of grid frequency and dc-link voltage in a localized manner. For optimal FR in both-side grids, a data-driven model of the HVDC-linked grids is then developed to design a data-driven linear quadratic Gaussian (LQG) regulator, which is incorporated with the converter feedback loops. Case studies on two different LCC HVDC systems are performed using the data-driven models, which are validated via comparisons with physics-based models and comprehensive MATLAB/SIMULINK models. The results of the case studies confirm that the optimal data-driven control strategy successfully exploits the fast dynamics of HVDC converters; moreover, cooperation of the HVDC system and synchronous generators in both-side grids is achieved, improving real-time FR under various HVDC system specifications, LQG parameters, and inertia emulation and droop control conditions. INDEX TERMS Data-driven control, dc-link voltage and current, high-voltage direct-current systems, line-commutated converters, linear quadratic Gaussian, real-time frequency regulation. NOMENCLATURE A.