While devotion to the Immaculate Heart of Mary was revealed through various private revelations, such those of Our Lady to the children of Fatima, it can be supported by the Bible.
Full of Grace
First of all, Mary is called "full of grace," a term that reflects her "immaculate" (from the Latin for "without stain") state.
The Catechism of the Catholic Church explains this connection.
A Sword will Pierce
The Gospel of Luke also talks about Mary's heart, in the context of Simeon's prophecy at the Temple.
This particular passage is often visually represented in art with a sword piercing Mary's heart.
Putting these two concepts together, devotion to the Immaculate Heart of Mary finds support in the Bible.