Question: how thanos got the infinity stones?
Answer: As the Collector explains to Star-Lord and his crew, before the creation of the universe, there were six singularities. Then, after the Big Bang exploded everything into existence, "the remnants of these systems were formed into concentrated ingots: Infinity Stones."