In Luke 10:20-21 the logic and substance of Jesus' rejoicing in Holy Spirit that Father opened "those things" to children and hidden from the "wise" is more clear: man should not rejoice in working of miracles, which includes having a power of subduing and expelling evil spirits, but only in "that your names are written in Heaven", that is to say, the name's being written in Heaven does not depend on miracle-working, but on a merciful and humble heart, for Lord desires mercy and not sacrifice (Matt 9:13) and will not despise the contrite and humble heart (Psalm 51:17), but will despise and refuse to recognize a puffed up miracle-worker, who would lack mercy (Matt 7:22-23).
Thus, in Luke it is clearer: "wise" here signify those people, Christians, who are puffed up with their knowledge, thinking that through it they have access to God, while forgetting about mercy and charity, for charity and mercy edify, while knowledge puffs up (1 Cor. 8:1), while "children" signify those really and not pretentiously wise believers, who use everything for the cause of the mercy and charity; who understand that gaining of merciful heart is necessary and indispensable for the Holy Spirit to dwell in it and for inheriting the Heavenly Kingdom.
But still, why is Jesus joyful in Holy Spirit that some people - the "wise" - become dull in heart through their knowledge, while others - the "children" on the contrary, become truly wise by cultivating charity?
Of course, it is absolutely wrong even to suppose that He rejoices in misery of the first category of the believers! On the contrary He rejoices being with His creations as already incarnated, having become one of them; Showing all human knowledge and wisdom to be futile, not building towards and not enough for salvation, and as such, worthy of being destroyed and abolished (1 Cor. 1:19). Rather, He will give to humans of all nations who would listen to Him, participation in His mercy and forgiveness, making them as "foolish", as He Himself is, for "foolishness of God is wiser than greatest wisdom of men" (1 Cor. 1:25).
Thus, substance of His rejoicing is that humans already can discover, have access to, at the utmost limits of their human wisdom and human intellectual efforts, which have failed to provide salvation, that which is supra-human, that transcends all human capacities and abilities, but is already a free gift of God, His saving and joyful grace, that comes from the realm of the eternal bliss, transcending the borders of the created order of reality.
And indeed, how not to rejoice in that this joy is hidden from those who are considered to be "wise" according to categories of human understanding? - for had it not been so hidden, humans would have conceived a mistake that their intellectual efforts make them partakers of this salvational grace and thus remain proud and forget to thank God; but since they will see that grace is not to be obtained by even the best of their efforts without God's gift, they will get a wonderful chance to understand the necessity of becoming like little children (Matt 18:3) and open up to God's free gift of graceful salvation.
That is why, it is not that He singles out only few elect and rejoices in warding them from others, the hopeless ones who will never become like the first. Not so at all, because with Him everything is possible (John 15:5) and it is exactly to the puffed up ones that He preaches warningly to repent and become like children, lest they will lose the Kingdom (Matt 18:3). In fact, Jesus wants all to be saved (1 Tim. 2:4) not only an elite few.
But Matthew 11:25-26 is more difficult, for here some other nuances appear, I think even more theological than in Luke's above passage. Here the context is that Jesus in Matt 11 teaches John's disciples the blessing of not doubting Him as the expected Messiah (Matt 11:6), and the grounds for not doubting Him are those healing miracles and resurrection of dead that He performs (Matt 11:4-5). Immediately afterwards, He discusses those people - for the "cities" denote people - who stumbled and for whom even the miracles were not enough to understand and acknowledge Him as the Messiah (Matt 11:20-24).
But then He rejoices for those whom the Father taught not to stumble towards Jesus, His Son, but to come to Him (Matt 11:25-26), and immediately makes a theological statement affirming His own divinity: "nobody knows the Son, but the Father" (Matt 11:27), that is to say, those who failed to accept Him, failed to understand the Father's universal calling as well, for only Father can lead humans to understanding who Jesus really is - His only-begotten Son (Matt 16:17), for only He knows Him and is known by Him.
Therefore, Jesus rejoices, like He rejoiced for Peter, that all those who did not stumble towards Him, were not instructed by their own reason, that is to say, "flesh and blood", but were illumined by the Father Himself (cf. Matt 16:17). Moreover, the Light through which He illumined them concerning the Sonship of Jesus is Jesus Himself, who brings them to the knowledge of the Father, for only Jesus knows the Father, and if anybody will know God in a due way, as the Father, he will be able of such knowledge only through the Son, for They - the Father and the Son - know each other exclusively and equally (Matt 11:27-28; affirmed also by John 10:15). Such an exclusive and equal mutual knowledge would have been impossible had Jesus been somebody illumined by the Father and not the very principle of illumination intrinsic to the Father, His (the Son's) Source; for, in fact, the Father is absolutely, ontologically unable to illumine anybody without His Son, (to use an early christian analogy/patristic, just as the sun is absolutely unable to enlighten anything without its rays that are intrinsic to it), and vice-versa, the Son is absolutely unable to work miracles without the Father co-working with Him, and thus, with this knowledge, there is no excuse for those who deny Christ, even purporting to be faithful to God by this very denial, after having seen Christ's miracles, which could not be performed but together with the Father.
Thus, He enlightens disciples to the new theology: God as the indissoluble unity of the love of the Father and the Son, that eternal relationship and glorious Unity which was between Them even before the creation of the world (John 17:15) and now revealed clearly to the disciples in the divine names of the Father and the Son. This eternal divine love should become also heritage of humans, for only through undertaking the "easy burden" and "light yoke" (11:29-30) of this love will they find eternal rest (ἀνάπαυσις); which is a paradox! - for all other creatures have as their aim that which pertains to the created order of reality, whereas humans, although being created, are unable to be satisfied by the entirety of the created order, for their salvation and ultimate destiny is not of this order, but the divine love that transcends the creation and pertains to the uncreated divine Realm. Thus, becoming "children", that is to say, of a humble and merciful heart, is clad by a divinely ironical meaning, for this childish humility of heart (the only condition for the Holy Spirit's presence in it), is in fact elevating humans to a loftier status than any most arrogant human would ever have imagined - namely, partaking in the bliss that has neither beginning nor end, becoming "children of God", through the Son of God (John 1:12) and the Spirit of Sonship and Freedom (Romans 8:15; 2 Cor. 3:17).
Not a meager reason for Jesus rejoicing in this in the same Spirit!