This LTT Video covers it quite well:
(They actually spoke to insiders in the industry for their info.)
I think it was nVidia who said, 'It's a demand issue, not a manufacturing issue.'
There are only a handful of companies that can actually make (fabricate) chips. The main ones I know are TSMC, Samsung and Intel.
Space at these fabs is booked years in advance by almost every company (nVidia, AMD, smartphone manufactures, car manufactures, camera manufactures, basically anything electronic) based on estimated product sales.
Because of the pandemic, computer sales have gone up more in the last year than they have in the last decade or two - people are buying stuff so that they can work/ do school from home but also with so many countries under strict 'stay home' orders, more people have been buying computers (or consoles - which also use AMD chips) for gaming in their spare time as well.
As such, demand has far exceeded what anyone thought it would when they booked the fab time a year ago and as nVidia or AMD can't physically make more chips (as they don't make them - TSMC does) and all the fabs are running 24/7 already then they physically can't make more.
Fabs also are incredibly complex and expensive to build, the US government just sunk a lot of money into building new ones ($billions) but it could be at least 2023 (and that's probably optimistic) before any chips actually get manufactured there.
Interestingly, Intel is basically the only company not facing massive shortages because they fab their own chips.
I think mining and the recovery in price of crypto currency probably hasn't helped either, but no one that LTT spoke too actually thought it was a major cause.
Nvidia should limit there Firmware that mining is not possible anymore with those videocards...
nVidia tried to issue a driver to limit some crypto currencies on the newly launched 3060, but there are already like 3 or 4 work arounds. Even then, I think it was mainly Ethereum it targeted, and would still mine bitcoin or whatever just fine.