An American Airlines flight that departed New York diverted back to the US with two hours remaining in the journey to Tokyo.