There are many reasons for this. Let me give you three of them.
First, Amir realizes the extent of Baba's love, because Baba has left everything he knows and he now in America he has nothing but himself and his son in America. Amir also realizes that the move was primarily for him. Baba wanted to give him an excellent education and to keep him safe. In view of these sacrifices, Amir is able to get past his insecurities.
Second, when Amir tells Baba that he wants to be a writer, it is clear the Baba is not happy. However, Baba will support him and love him. This act shows a lot. Also Baba pays for the wedding, which cost him his life savings. Again it is this sacrifice that show Amir the love of Baba.
Third, there is also the fact that when people struggle, they need to rely on each other for support. With little in America, the two naturally get closer.