Lucas had James Earl Jones record “I killed your father” for the penultimate scene, and most of the crew thought that would be the surprise revelation.
Jones actually said, “killed” when the scene was filmed. He later dubbed in the secret line, “I am your father,” surprising everyone.
Just who knew, and when, is uncertain. Jones himself may not have known when the scene was filmed. Did Luke know? Maybe not, and his expression of surprise when it was revealed may have been genuine. It is possible that everyone except Lucas expected the word to be “killed.”
It could have been a great ending. Future films could have shown Luke chasing Vader across the galaxy, seeking revenge for his father’s death. More long-lost relatives could have appeared, siding with Vader or Skywalker. Any writer could tell you that this was the clincher with the most clinch, since it opened so many possibilities.
Why did Lucas change it? Maybe because he knew it would do exactly what it did: surprise everyone, including the cast.