All the Romance languages have developed compound perfect tenses in the course of their history, even though there were no compound (periphrastic) perfect tenses as such in classical Latin. The Germanic languages, including English, have also developed compound perfect tenses over time following the same principles. But the Portuguese present perfect tense, or pretérito perfeito composto to give it its Portuguese name, is a linguistic curiosity in a number of respects.
Originally, in both Romance and Germanic languages, what we now call past participles were not really verb forms at all, but adjectives derived from verbs. Indeed, in both English and Portuguese, many past participles may also occur as adjectives. Compare the uses of ‘broken’ in ‘I’ve broken the window’ (past participle) with ‘the broken window’ or ‘the window is broken’ (adjectival uses). Latin had a so-called resultative construction involving the verb habere ‘to have’ in its full lexical sense of ‘to possess’ and an adjectival participle qualifying the thing possessed in sentences like epistulam scriptam habeo, equivalent to saying ‘I have the letter written’. As Latin developed into the modern Romance languages, this resultative construction (‘I have the letter written’) morphed into a fully-fledged verb tense (‘I have written the letter’). In the process, the verb ‘have’ lost its full lexical meaning and became grammaticalized as an auxiliary and ‘written’ was no longer perceived as an adjective qualifying ‘letter’, but rather as part of the compound (periphrastic) verb form. Accordingly, it was no longer made to agree in case, gender and number with the direct object. Exactly the same development can be seen in English during the Old English period when English nouns and adjectives still inflected for gender, number and case just like in Latin. In some Romance languages, past participles still have to agree with the direct object under certain circumstances, e.g. in French, when the direct object of a perfect tense precedes the participle, cf. j’ai fermé la porte ‘I’ve closed the door’ (noun direct object follows the participle so no agreement) vs. La porte? Oui, je l’ai fermée ‘The door? Yes, I’ve closed it’ (pronoun direct object precedes the participle so the latter has to agree in gender). The fact that this agreement in French is only made in the written language and cannot be heard in speech with the vast majority of verbs (fermé, fermée, fermés and fermées are pronounced identically) suggests that it is a grammatical relic that no longer has any semantic importance. Indeed, in Portuguese and Spanish, the past participle has become invariable in all perfect tense constructions.
It should be said at this point that in both early Romance and Germanic languages, intransitive verbs, i.e. those that cannot take a direct object, originally formed their perfect tenses with the auxiliary ‘to be’ rather than ‘to have’. This is entirely logical because whereas the past participles of transitive verbs have passive meaning (broken = which has been broken), the past participles of intransitive verbs have active meaning (gone = which is gone). Modern languages have maintained this distinction to differing degrees: in Italian, it is a general rule that intransitive verbs expressing change of location or state form their perfect tense with essere ‘to be’ while all other verbs use avere ‘to have’; in French, the dividing line is less clear with a more limited number of verbs using être ‘to be’ as their perfect auxiliary. In these languages, the adjectival participle logically has to agree in gender and number with the subject of the sentence when the auxiliary is ‘to be’. In Portuguese and Spanish, the equivalent of ‘to have’ is used for all verbs. Among the Germanic languages, German, Dutch and Danish still make a distinction between transitive verbs which use ‘to have’ and some kinds of intransitives which use ‘to be’, while in English ‘to have’ is now used for all verbs, though the use of ‘to be’ can still be found in older forms of the language (e.g. ‘Christ is risen’, ‘I am come in my Father’s name’ etc.).
So what is curious about the Portuguese perfect tenses in particular? The first thing is that Portuguese is the only modern Romance language that uses the auxiliary ter derived from Latin tenere ‘to hold’ in addition to the auxiliary haver derived from Latin habere, which is the one used in all other Romance languages, including Spanish. Furthermore, as any student of Portuguese should know, the auxiliary ter is the ONLY option in the present perfect indicative (tenho feito) and subjunctive (que tenha feito) and perfect infinitive (ter feito), whereas haver can be used as an alternative to ter in the pluperfect indicative (tinha/havia feito) and subjunctive (tivesse/houvesse feito) and future perfect subjunctive (tiver/houver feito), though its use is now restricted to more formal written style. In fact, in earlier forms of Portuguese, the auxiliary haver also occurred in the present perfect, but this usage died out a long time ago, as to all intents and purposes has the use of haver as an auxiliary in the spoken language of Brazil. Contrary to what we might think, the consensus among experts is that ter was the original auxiliary for the perfect tenses in Portuguese, and that haver was introduced as a more literary/formal alternative modelled on Spanish and French.
The second curious thing about the Portuguese perfect tense is that it has iterative meaning, i.e. it refers to actions or states that have been recurring or continuing for a while up to and including the present. In all the other Romance languages, the perfect tense is much more commonly used to refer to one-off actions, though it may also have iterative meaning in some contexts. So in Portuguese you can say Tenho comido muita maçã ultimamente ‘I’ve been eating a lot of apples lately’ but you cannot say *Tenho comido uma maçã hoje de manhã, whereas in Peninsular Spanish it is perfectly correct to say He comido una manzana esta mañana ‘I’ve eaten/I ate an apple this morning’ and in French J’ai mangé une pomme ce matin. As the translation above shows, the Portuguese perfect tense corresponds in meaning to the English present perfect continuous (‘have been eating’) rather than the present perfect simple (‘have eaten’). So the Portuguese perfect tense is unique among the Romance languages in both its formation (using the auxiliary ter instead of haver) and its meaning (iterative rather than one-off).
But the mystery doesn’t end there. The present perfect indicative can only have iterative meaning so the question Você tem dormido bem? can only mean ‘Have you been sleeping OK?’ (i.e. of late) and never ‘Have you slept OK?’ or ‘Did you sleep OK?’, but the present perfect subjunctive can also refer to one-off action, so it is perfectly correct to say Espero que você tenha dormido bem essa noite ‘I hope you slept OK last night’. The same goes for the perfect infinitive: Eu me sinto melhor por ter dormido bem essa noite ‘I feel better for having slept well last night’. And while the pluperfect can have iterative meaning, more often than not it refers to a one-off action and would be understood as such unless the wider context dictated otherwise, thus Eu tinha comido muita maçã would tend to be interpreted as ‘I had eaten a lot of apples’ rather than ‘I had been eating a lot of apples’, which would more likely be expressed as Eu andava comendo or Eu vinha comendo muita maçã.
It might be tempting to think that there is some connection between the choice of the auxiliary ter as opposed to haver and the iterative meaning of the present perfect. But evidence from earlier periods of the language shows that ter + past participle was at one time used to express one-off actions too. It may just be that because the job of describing one-off actions is done perfectly well by the preterite tense (pretérito perfeito simples: eu falei, ele fez etc.), the only role left for the present perfect is to describe iterative actions and states. The fact that such actions and states continue into the present rules out the use of the pretérito perfeito simples, which can only refer to actions already completed and finished before the present. It may also be significant that the closest relative of Portuguese in the Romance family, which is Galician, has done away with compound perfect tenses altogether.