Chief executive Noel Quinn, appearing before the Foreign Affairs Committee, was told the bank was turning a blind eye to the situation.
HSBC has historic links to Hong Kong, where pro-democracy campaigners have taken to the streets.
Mr Quinn mounted a robust defence of the bank, saying: "I can't cherry-pick which laws to follow."
HSBC faced accusations of acting in a political manner and being too close to the Chinese authorities after it emerged last year that the bank had frozen accounts belonging to pro-democracy politician Ted Hui and members of his family.
There has also been criticism over HSBC's actions last summer, when it was one of a number of institutions which appeared to welcome the introduction of a new security law in Hong Kong.
On Tuesday Conservative MP Andrew Rosindell said HSBC showed "double-standards, hypocrisy and appeasement" in acceding to China's sweeping security crackdown in the former British colony.
He claimed the bank was operating a "hear no evil, see no evil" approach to Hong Kong's problems, while Labour's Chris Bryant accused HSBC of "aiding and abetting one of the biggest crackdowns on democracy in the world".
But Mr Quinn categorically denied the bank had acted on political grounds, and said the company would only freeze accounts when it had received a formal request from law enforcement officials.
If the bank received such a request, he said, it had no option but to comply, or it would be committing a criminal offence.
"I have to obey the law... If we commit a criminal offence that puts us and millions of deposits at risk," Mr Quinn told the committee.
During sometimes testy exchanges with MP's, Mr Quinn said he accepted that the current environment in Hong Kong was "challenging".
Asked if he was prepared to take his company away from Hong Kong if the situation continued to deteriorate, he said "the answer is no".
The company, founded in Hong Kong but headquartered in Britain, had been in the region for 155 years, Mr Quinn said, and was "100% committed" to remaining there.
Pressed on the political affiliations of its staff in Hong Kong, he insisted that he would not "go around asking all my employees in China 'are you a Communist party member'".
Questioned about HSBC's support for the security law, Mr Quinn said the bank had simply pointed out that it wanted the security situation in the region to be stabilised after 18 months of decline.
Matters had reached a point, he said, which were detrimental to the economy and to the population of Hong Kong. Stability was needed to repair communities and the economy.
But Mr Quinn insisted he was trying to do its best by its customers, and to stay out of politics.
It would do more harm to Hong Kong communities, he claimed, if HSBC chose to walk away from the region, he added.
Embrace what you don’t know, especially in the beginning, because what you don’t know can become your greatest asset. It ensures that you will absolutely be doing things different from everybody else.