Why did we use the present perfect in the first one, while we used the past simple in the second one? Although the two sentences are similar and I cant find any difference between them at all.
Because in the first example they are trying to show a connection to the present. This is one of the more complex reasons that present perfect is used, so don't worry if it's not immediately clear to you.
I'll give you some examples and see if it makes sense to you in a pattern:
Tom's wife died. They were married for 20 years. (simple past, they are not married now)
Peter and Jane are still married, they have been married for 20 years (present perfect, because they are still married now).
I lived in Brazil for many years. (I no longer live in Brazil).
I have been living in Costa Rica for a few years. (I live in Costa Rica now)
Did you eat the cake I sent you last Christmas? (simple past, no connection with now)
Have you eaten? (present perfect, because he wants to know if you are hungry now)