In the beginning of Star Wars IV. When C-3PO and R2D2 land on Tatooine, it seems like C-3PO doesn't know where he is?
Why doesn't C-3PO recognize his home planet?
Because at the end of Episode III, C-3PO had his memory wiped by Captain Antilles
“How lovely!” C-3PO exclaimed. “His daughter is the child of Master Anakin and Senator Amidala,” he explained to R2-D2. “I can hardly wait to tell her all about her parents! I’m sure she will be very proud-“
“Oh, and the protocol droid?” Senator Organa said thoughtfully. “Have its mind wiped.” The captain saluted. “Oh,” said C-3PO. “Oh, dear.” - Star Wars: Revenge of the Sith - Novelisation
At the end of Star Wars Episode III: Revenge of the Sith:
C-3PO and R2-D2 fall into the custody of Bail Organa, who orders that C-3PO's memories be erased to protect the twins from their father.
Vader: "No… I am your creator!"
C-3PO: "Noooo!! You see, sir, shortly after the Jedi were wiped out, my memory was erased. So that could explain why I'm having difficulty verifying your statement."
And in an EU novel, C-3PO was advised by the silver protocol droid CP-16 to accept a memory wipe if the situation arose:
C-3PO conferred with a silver protocol droid who warned him that dark times were ahead. He told C-3PO to accept a memory wipe if it was ever offered, as the alternative would be living in confusion as the lines between good and evil were blurred.