Google Takeout works really well, but you can also connect using IMAP or POP3 to download all your emails with an email client like Thunderbird.
Then, if you've setup a new email account with another provider, you can connect using IMAP and copy your emails that way.