WASHINGTON—An FBI agent criticized for exchanging anti-Trump text messages with a bureau lawyer during the 2016 presidential election told lawmakers Wednesday that his work on two high-profile investigations related to the campaign wasn’t politically biased, members of Congress said.

During a voluntary, nine-hour, closed-door interview with members of the House Oversight and Judiciary committees, Peter Strzok told lawmakers that the texts were simply messages between friends that weren’t indicative of the direction of the...