I believe its related to the 14 amendment (I could be wrong on the number) which provided citizenship to freed slaves. It was written broadly and ended up including anyone born here with a few exceptions.
NOTE: This issue has never been reviewed by the supreme court. Nobody wants to open that can of worms.
read my link