This paper systematically investigates the comoving megaparsec-scale intergalactic medium (IGM) environment around galaxies traced by the Lyα forest. Using our cosmological hydrodynamic simulations, we investigate the IGM–galaxy connection at z = 2 by two methods: (i) cross-correlation analysis between galaxies and the fluctuation of Lyα forest transmission (δ
F) and (ii) comparison of the overdensity of neutral hydrogen (H i) and galaxies. Our simulations reproduce observed cross-correlation functions (CCFs) between Lyα forest and Lyman-break galaxies. We further investigate the variation of the CCF using subsamples divided by dark matter halo mass (M
DH), galaxy stellar mass (M
⋆), and star formation rate (SFR) and find that the CCF signal becomes stronger with increasing M
DH, M
⋆, and SFR. The CCFs between galaxies and gas density fluctuation are also found to have similar trends. Therefore, the variation of δ
F–CCF depending on M
DH, M
⋆, and SFR is due to varying gas densities around galaxies. We find that the correlation between galaxies and the IGM H i distribution strongly depends on M
DH as expected from linear theory. Our results support the ΛCDM paradigm, confirming a spatial correlation between galaxies and IGM H i, with more massive galaxies being clustered in higher-density regions.