The screen and stage star will reflect on being the last member of his family to carry his surname on Wednesday night's Who Do You Think You Are?.
Speaking about the end of the McKellen line, Sir Ian, 77, said: "I don't feel anything about it, really.
"I think I've always known I wasn't going to have children, because I'm gay. That wouldn't have been true today, would it."
Sir Ian McKellen 'too selfish' to consider fatherhood and glad it never happened
When does Who Do You Think You Are start, who is on the new series?
Who Do You Think You Are: Amanda Holden fans in tears amid sad history
I think I've always known I wasn't going to have children, because I'm gay. That wouldn't have been true today, would it
Sir Ian McKellen
"I don't feel I've got a responsibility to produce another McKellen. They might all be girls, then they'd all get married," he added.
Asked if he would have liked to have children, Sir Ian said he was "glad" not to have them, adding "Bringing up children is the most dreadfully difficult thing to do, and so few people are good at it.
"I'm far too selfish."
He said appearing on the programme was 'entirely positive'
He said appearing on the programme was "entirely positive".
He added: "All the people that we meet were people I was interested in learning more about them, and I thought on the whole they had very interesting, worthwhile lives."
The veteran actor and LGBT rights campaigner said all his newly discovered relatives had "social awareness".
Get Quotes on Home Insurance
The LGBT rights campaigner said all his newly discovered relatives had 'social awareness'
He said: "They're not neurotically bound up with their own lives, they're all – whether they're actor, singer, social reformer, painter – they're all outgoing.
"They're in the society and are part of it and try and change it. If that is a family trait, I confirm that in my own life."
Who Do You Think You Are? with Sir Ian McKellen airs on BBC One on Wednesday at 8pm.