You will automatically be added to your corp’s chat channel (called “Corp”), whether you’re in a player corp or an NPC corp. Likewise, if you’re in a player corp that is part of an alliance, you’ll also be added to their “Alliance” channel. Neither of these can be closed, though you can move them to a separate window stack and minimize the stack if you don’t want to see it.
As for local, you cannot leave that channel. You will always be in the local chat for whatever star system you’re in at the moment. Importantly, local gives you vital intel about threats around you, so you don’t want to minimize it. Rather, you want to setup appropriate contacts, tag threats as red, and watch local like a hawk. Local chat and d-scan are your #1 and #2 best tools to avoid unexpected losses.