Why on earth would she do such a thing?
Why, indeed? For a normal person with an illegitimate child, the answer might be to provide some minimal aura of respectability. But, everything I've heard of Ann Dunham indicates she was a far from normal leftwinger, and not at all worried about what others thought. So why indeed? Its hard to imagine an 18 year-old worrying about whether or not her bastard child would be considered a "natural-born" citizen so he could run for the president 45 or more years in the future.