Indira Nehru was married to Feroze Gandhi, who was an Indian politician and journalist. And that is where from the surname ‘Gandhi’ came into the Nehru family.
It has nothing to do with Mahatma Gandhi or his family directly.
Feroze was not related to the Mahatma. He was born as Feroze Ghandy but later changed his surname to Gandhi after being highly influenced by the Mahatma during the freedom movement in the 1930s.