There are so many sub-projects in the JIRA source code, is there some documents to explain what's purpose of every sub-project?
And how to debug the JIRA source code in local machine?
There isn't a document that explains each of the subfolders, etc in the JIRA Source Code but that would be beneficial. You can help get that created by going to https://jira.atlassian.com/secure/Dashboard.jspa and creating a feature request to have the developers publish and article such as the one you're seeking.
In regards to debugging JIRA, there are two articles that may help you:
Creating a Remote Debug Target
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events