Swift, 22, recently broke up with Conor Kennedy -- a member of the political Kennedy family -- but could be dating Styles, 18, People magazine reported Saturday.
Lopez said on his MY FM-radio, Los Angeles, show Styles was on hand at the "X Factor" set Thursday during Swift's rehearsal for a performance of her song "State of Grace."
"I said, 'What are you doing here?'" Lopez said Friday. "And he sort of [pointed] toward Taylor."
A witness at the rehearsal, whose name was not reported, confirmed Lopez's observation.
"He was smiling at her while she rehearsed. When she was done he jumped up on stage, picked her up, put her over his shoulder and carried her off stage," the onlooker told People. "The whole crew was really surprised."