this is a question i see come up constantly in visa-holder communities and almost nobody gives a straight answer because everyone's situation is slightly different and 'talk to an immigration attorney' is technically correct but also not that useful when you just want to understand the landscape.
so here's my understanding after talking to two immigration attorneys and a handful of people who have done this. not legal advice, just a sharing of what i've learned.
the H1B is tied to a job description, not a company or an industry. what matters is whether your new role would constitute a 'material change' from the petition that was originally filed. if your specialty occupation changes significantly, you may need an amended petition or in some cases a new one.
switching industries is usually fine if the function is the same. moving from SWE at a fintech to SWE at a health tech company is typically not a material change. your petition says something like 'software engineer using Java and Python to develop enterprise applications' and that description probably fits both roles.
switching functions is where it gets complicated. if you're a data scientist and you want to move into product management, your specialty occupation is changing. whether that requires an amended petition depends on how the new employer wants to handle it, and some employers won't take on that risk.
what i actually did: i was a data analyst and moved to a data engineering role. my new employer's immigration counsel said it was close enough that they filed an amended petition (not a new one), which is faster and doesn't eat an H1B cap slot. the whole thing took about 6 weeks.
if you're trying to make a bigger functional switch, like software to sales, or engineering to product, the math gets harder. the new employer's counsel will drive this, not you. so the question to ask in later stages is: 'have you sponsored H1Bs for this type of role before, and how does your team typically handle amended petitions?'
anxious about this constantly but at least i feel like i understand the rules now.