After gaining independence in 1947 India didn’t want to have close relations with the Brits and by extention the US. Pakistan was what was left to ally in the region.
Umm, it’s actually not as simple as that. India had VERY CLOSE relations with the U.K. since independence. Even proximity to the USSR didn’t hinder ties with the U.K. Which country was the largest export user of the English Electric Canberra, Hawker Sea Hawk, Sea Harrier, Sepecat Jaguar, Vickers battle tank ... the list goes on