To export your messages and media from chat and community:

1.    Sign in to the Export page with your Microsoft Account.

2.    Select the option to download your Chat history, Media, or both, and then select Submit request. Select Continue when prompted.

3.    You will need to check back periodically to the export page on the status of your export, which you can see at the top of the page under Available Exports. A link to download your files will also appear there when they are available to download.

4.    Select the Download button to download your files.

https://privacy.teams.live.com/ui/en/dataexport

@https://answers.microsoft.com/en-us/msteams/forum/all/how-to-export-an-entire-teams-chat-history-with-an/e67a8af0-22be-4af4-8c93-a9652f3282b9