The US considers China a rising rival.
In the case of Huawei there were 3 major factors to it being targeted:
Political
Clearly, the previous US administration made a big show of "standing up to China" and Huawei was a convenient pressure point. Claims that Huawei bypassed sanctions to Iran, which is the core of the Meng Wanzhou extradition case only added fuel to this. But it's unclear that the substance of treating China as a rival will change much under Biden who is likely to coordinate better with US allies .
Economic/commercial
Huawei was at one time, rising quickly in 5G networks and the top Android smartphone vendor. Being associated with China, rather than an ally like Samsung's South Korea made its dominance unwelcome.
Security/military
5G networks, whatever their current benefits to users, are the future of cellular phone technology, at least until 6G comes out. The US, not incorrectly if one considers China a potential military rival, was not keen on having its networks and those of its Western allies largely supplied by a Chinese vendor which was putting Western suppliers out of business (by having better, cheaper, gear).
GCHQ (Government Communications Headquarters) in the UK did an audit of Huawei's code (and hardware?) and didn't find all that much, except that it didn't seem very well written (all is relative, telecoms people tend to make fun of practices of certain Western network vendors rhyming with a popular shortening brand as well).
GCHQ not finding anything may or may not mean much, but recall that state-sponsored hackers in China are suspected in a number of computer intrusions and espionage.
If we assume we could be moving to a Cold War 2, this puts China in a very different light than Russia during Cold War 1 where no Western country would have bothered installing any critical Soviet civilian high tech infrastructure because that would have been an oxymoron.
Additionally, Huawei's CEO has , supposedly, somewhat close ties with the Chinese military and CCP and that was another red flag in this context. Those accusations don't seem all that solid - of course you'd expect a high tech company to having some dealing with the military and many of the US's companies do as well. And you'd expect many people joining the CCP to lubricate dealings with the government.
However, China does have a law compelling collaboration with the intelligence services.
Two pieces of legislation are of particular concern to governments — the 2017 National Intelligence Law and the 2014 Counter-Espionage Law. Article 7 of the first law states that “any organization or citizen shall support, assist and cooperate with the state intelligence work in accordance with the law,” adding that the the state “protects” any individual and organization that aids it.
And it appears that organizations and individuals don’t have a choice when it comes to helping the government. The 2014 Counter-Espionage law says that “when the state security organ investigates and understands the situation of espionage and collects relevant evidence, the relevant organizations and individuals shall provide it truthfully and may not refuse.”
Sanctions
Huawei has been put on a US entity list:
Entities on the Entity List are subject to U.S. license requirements for the export or transfer of specified items, such as some U.S. technologies.Being included on the Entities List is less severe than being designated a "Denied Person," which Chinese manufacturer ZTE was once subject to.
As a result, Huawei has been unable to procure a number of Western technological inputs, including:
(note that what Huawei can or cannot buy is in ongoing flux as the US can and does grant licenses to trade on an exception basis)
This has had fairly negative consequences for Huawei.
From first to sixth: Huawei’s phone business tanks thanks to US sanctions
The US has also successfully lobbied a number of countries to generally exclude Huawei 5G tech from their networks.