Itinerary information they get from Amadeus[1] or ITA software (which google acquired to kickstart their flights product). Prices I imagine come from integrations with the hundreds of online travel agencies like Expedia, eDreams, etc.
[1] https://skift.com/2012/08/07/amadeus-working-to-oust-ita-at-...