You can leave a community you are a member of whenever you like.

First, go to the Community main page by clicking Communities tab in the side panel and selecting the community you want to leave

Then click Visit Community to be taken to the Communities main page.

After this, to have the option to leave simply click on the three dots below your profile icon in inthe top right corner

Select Leave this community and confirm your choice by clicking leave when prompted