The EU261 applies to operating air carriers only. Since the flight is on a non-EU carrier and is terminating in the EU, it would not be covered under EU261. If your flight was operated by Lufthansa, regardless of whether you purchased your ticket from United Airlines or Lufthansa, your flight would qualify under EU261.