Nowadays, accessing Gmail in Thunderbird is somewhat tricky. Google's new authentication system implementation forces users to upgrade their Thunderbird into version 38 or later. If not, any Gmail account can't be used in Thunderbird. Here some steps to connect your Thunderbird to Gmail account.
1. Upgrade Your Thunderbird
We've explained how to upgrade Thunderbird yesterday. You should have at least version 38.
2. Enter A Gmail Account
To access Gmail, open menu File > New > Existing Account.
Then enter your account credentials firstto the text boxes.
Then Select the protocol you like (the method of saving your emails) whether it is IMAP or POP3.
3. Enter Your Authentication Credentials
A new browser window appears, asking you to enter your credentials. For you didn't know, this new behavior is caused by a new policy (2-factor authentication using OAuth2 implementation) from Google. For later usage, this will be not too comfortable. This has been discussed in Thunderbird bugzilla 849540.
4. Access Your Emails
While finished successfully, Thunderbird will download your emails into local inbox folder.
For later settings with Gmail service in Thunderbird, you can refer to Gmail official support page. Mozilla also has official page for Gmail set up in Thunderbird.