WASHINGTON — President Obama is nominating Eric K. Fanning, a close civilian adviser to Defense Secretary Ashton B. Carter, to be the secretary of the Army, an appointment that would make him the first openly gay secretary of a military branch.