I have seen many images like the following that portray Lord Hanuman tear-open his chest and reveal Lord Rama and Sita inside it. What is the story behind this?
This is described in the later parts of the Ramayana. After Lord Rama came back from his vanavasa of 14 years and winning over Lanka Naresh Ravana, he was coronated as Ayodhya Naresh - the King of Ayodhya. In the celebration, precious ornaments and gifts were distributed to everyone. Hanuman was also gifted a beautiful necklace of diamonds by Sita - the wife of Rama.
Hanuman took the necklace, carefully examined each and every diamond, pulled them apart, and threw them away. Most were surprised by his behavior.
When asked as to why he was throwing away the precious diamonds, he replied that he couldn't find Rama in any one of them. Thus, they carried no worth to him since anything in which there is no Rama is without worth.
When asked if Lord Rama was in Hanuman himself, he tore his chest apart to reveal his heart. The on-lookers, now convinced of his genuine devotion, saw the image of both Rama and Sita appearing on his heart.
As Awal Garg says, the popular story of Hanuman tearing his chest open occurs in the context of him receiving a string of pearls at Rama's coronation. But the chest-tearing story does not seem to actually be there in the Ramayana, which just says this:
Rama presented to Seetha, an excellent string of pearls, furnished with superior gems, shining like a beam of moon-light; two clean and beautiful raiment and lovely ornaments. Looking towards Hanuman the monkey, Seetha, daughter of Janaka, having taken off the pearl-string from her neck, repeatedly caught the glimpse of all the monkeys. Looking at her, Rama who was acquainted with the gesture of another, spoke to Seetha as follows: "Dear Seetha! Give the pearl-necklace to a person, with whom you are pleased and in whom the following viz. sharpness, firmness, renown, dexterity, competence, modesty, prudence, virility, prowess and intelligence are ever present." The black-eyed Seetha gave that pearl necklace to Hanuman. Hanuman, the foremost among the monkeys, by wearing that necklace, which was as white as a heap of moonlight-beams, shone brilliantly as a mountain silvered by a white cloud.
So it looks like Hanuman just accepts the necklace. Now it's possible that that the chest-tearing story is described in some Purana or other scripture, but so far I haven't found any.
The story behind those images of Hanumān tearing open his chest can be found in the Laṅkā-kāṇḍa of Kṛttivāsa Rāmāyaṇa. Although, in this Rāmāyaṇa, it was not Rāma's picture that is revealed inside Hanumān's chest but Rāma's name.
After Rāma's coronation, Lakṣmaṇa makes fun of Hanumān as he starts breaking and chewing the gems of the precious necklace that Sītā has just gifted him. Upon Rāma's prompting, Hanumān explains that he couldn't find Rāma's name anywhere on the necklace and such a hāra was worthless to him. Lakṣmaṇa then questions Hanumān as to how he's able to live with a body that has Rāma-nāma nowhere written on it. This incites Hanumān to tear apart his chest to reveal Rāma's name written on every one of his bones.
(125) Coronation of Rāma
. . .
(126) Distribution of gifts to monkeys by Rāma and Sītā
. . .
Then Sītā took out her hāra. It was of immense value. No one could value it in the universe. The very sight of the hāra kept all the people amazed and they started looking at one another. It had in it many gems, pearls and precious stones. All the chief warriors looked at each other (strangely thinking) as to who would get that hāra.(721)
'To whom the hāra be presented', thinking in her mind", Sītā looked towards Rāma and understood that he desired it to be given to anyone she liked. (She got the messages, invisibly), "When everything was in the dark and no trace of (Sītā) was available. Who searched for her? When all of us were dead, who brought back to life all of us. Considering all these facts, this hāra should be given to such a person by which no one would feel small". Jānakī then repeatedly looked towards Hanumān, who rushed towards Jānakī and wore the hāra round his neck. The neck of Māruti was decorated with it.
Hanumān then bowed at the feet of Jānakī. Then she blessed him thus, "You will enjoy eternal life and always remian free from pain and grief. The glory of Rāma will last till the Sun and the Moon illumine the universe and you will remain eternal. O Hanumān, I give this boon to you. Wherever there would be the recitation of the name of Rāma, you would be present at that place, irrespective of the distance till that time the recitation continued". (722)
(127) Projection of Rāma's name by Hanumān by tearing out his chest
Holding the hāra in his hands, Hanumān, broke each and every gem in it by chewing it. Lakṣmaṇa laughed at this act of Hanumān. Annoyed, he spoke these words. (723)
"O Lord, I submit, why have you adorned the neck of Hanumān with this garland? These monkeys, by nature are counted amongst the animals. Why did you give this hāra of gems to a monkey?" (724)
Sri Rāma said, "Listen O Lakṣmaṇa, (you are dearer to me) than my life. The reason for which Hanumān has broken the pearls of the hāra is well-known to him. You better ask Hanumān the reason for it in the presence of the court". (725)
Hanumān said, "Listen, O Lord Lakṣmaṇa, I received this hāra taking it to be priceless. Thereafter I found that Rāma's name was nowhere to be found in it. The riches without the name of Rāma have no value for me and should be discarded." (726)
Lakṣmaṇa then observed, "O Hanumān, the name of Rāma does not appear over your body. Then why are you keeping this body alive? O son of the windgod put an end to this body as well." (727)
On hearing this, Hanumān tore away his chest with his nails and projected it towards Lakṣmaṇa. After tearing out his chest before the audience he projected that the name of Rāma was inscribed in lakhs, over each and every bone of his body. All the people present there were surprised. Lakṣmaṇa, however, felt ashamed and bowed his head. (728)
Lakṣmaṇa said, "O brave Hanumān, listen. There is no other devotee of Rāma like you. You know Rāma and Rāma is known to you. How could I know the limits of your glory?"
Hanumān said, "I am a forest monkey, I am the slave of Rāma and a servant to you."
Rāma was amused at the talk of Hanumān.
The learned Kṛttivāsa recited the poetry of Laṅkā Kāṇḍa. (729)
in progressive kriya meditation there comes a stage when the heart chakra lays itself bare, reverbrating in all its fullness of energy of divine love. the highly spiritualized awareness of the advanced practitioner/hanuman at this stage, experiences his own devotion for God/Ram fully radiant with the light of wisdom/sita and understanding, here in the heart center. thus the symbology of Hanuman (advanced practitioner) ripping open his own heart is an actual living experience of an advanced spiritual state of consciousness.
Necklace was gifted by Vibhishan, Ravan's brother and the king of lanka after Ram had defeated and killed Ravan. It was gifted initially to lord Ram on his coronation as the king of Ayodhya, but Ram thought it is a jwellery, so better Sita wear it. Sita gave it to Hanuman as he was a big devotee of Sita and Ram. Then, Hanuman examined each and every stone in the necklace carefully but did not find Ram in any of them, to examine better, he broke the necklace to examine each stone more carefully. Watching this, king of Lanka Vibhishan got enraged and said that it was a very expensive necklace that you broke. To this, Hanuman replied with humbleness that what do I have to do with expense, only something which has Ram in it is valuable for me. On this, one person from Lanka who was sitting there asked if Ram was inside him too? To this question, Hanuman then, tore his chest and everyone saw Sita and Ram in heart of Hanuman and were clear that his devotion towards Sita and Ram can never be questioned.