BackgroundInfluenza A viruses have undergone rapid evolution with virulent; however, complete and comprehensive data on gene evolution and amino acid variation of HA and NA in immunosuppressed patients was few. In this study, we analysed molecular epidemiology and evolution of influenza A viruses in immunosuppressed population, and immunocompetent population were used as controls.MethodsFull sequences of HA and NA of A(H1N1)pdm09 and A(H3N2) were acquired through reverse transcription-polymerase chain reaction (RT-PCR). HA and NA genes were sequenced using the Sanger method and phylogenetically analysed using ClustalW 2.10 and MEGA software version 11.0.ResultsDuring the 2018–2020 influenza seasons, 54 immunosuppressed and 46 immunocompetent inpatients screened positive for influenza A viruses by using the quantitative real-time PCR (qRT-PCR) were enrolled. 27 immunosuppressed and 23 immunocompetent nasal swab or bronchoalveolar lavage fluid samples were randomly selected and sequenced using the Sanger method. A(H1N1)pdm09 were detected in 15 samples and the remaining 35 samples were A(H3N2) positive. By analyzing the HA and NA gene sequences of these virus strains, we found that all A(H1N1)pdm09 viruses shared high similarities to each other and the HA and NA genes of these viruses exclusively belonged to subclade 6B.1A.1. Some NA genes of A(H3N2) viruses were not in the same clade as those of A/Singapore/INFIMH-16-0019/2016 and A/Kansas/14/2017, which may have led to A(H3N2) being the dominant strain in the 2019–2020 influenza season. Both A(H1N1)pdm09 and A(H3N2) viruses showed similar evolutionary lineages patterns of HA and NA between immunosuppressed and immunocompetent patients. Compared with the vaccine strains, there were no statistically significant of HA and NA genes and amino acid sequences of influenza A viruses in immunosuppressed and immunocompetent patients. However, the oseltamivir resistance substitution of NA-H275Y and R292K have been observed in immunosuppressed patients.ConclusionsA(H1N1)pdm09 and A(H3N2) viruses showed similar evolutionary lineages patterns of HA and NA between immunosuppressed and immunocompetent patients. Both immunocompetent and immunosuppressed patients have some key substitutions, which should be of note monitored, especially those with potential to affect the viral antigen.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12985-023-02067-2.