American Airlines Inc. violated federal law by filling its 401(k) plan with funds from investment companies that pursue environmental, social, and corporate governance goals, a Texas federal judge ruled Friday in the biggest victory yet for opponents of the strategy.