If your heart is full of goodness, then goodness will spill out of it. If your heart is full of evil, then evil will spill out.
If your heart isn’t in something, then you may not do it as well as you could. You may not do it at all. You aren’t putting forth whole-hearted effort. If your heart is in something, you put forth better effort. You do it as best as you can because you are whole-hearted about it.
Energy flows where attention goes. Wherever and whatever your heart is set on, that’s where you’ll go and what you’ll want to do.
Essentially, who you are and what you do are determined by where your heart is and by what is in it.
In the Old Testament, we see God often reminding His people that He wants their hearts. They can perform “worship” all they want, but if they are not obeying God because they want to in their hearts, then it all means nothing.
In Proverbs 4:23 we are told to guard our heart, because what we do flows from it. Vigilantly keep bad things out and good things in, because who you are inside will issue forth into your life. It’s a lot like the flow of water. If the source is dirty, so is the water. If the source is clean, so is the water.
In Matthew 12:23-35 and Luke 6:43-45, we see Jesus talking about how your heart can be known by what you do and say, just like how you can tell the goodness of a tree based on the fruit it produces. Whatever the condition of your heart, that’s the condition of what it will produce in your life.
In the context of Matthew 6:21 and Luke 12:34, we see Jesus saying that what you treasure has your heart. And whatever has your heart will have you. If money, resources, or another worldly thing has your heart, you will spend yourself towards that effort. If God has your heart, you will spend yourself towards His effort. But you can only spend yourself entirely for one or another master, else you are not wholly serving any of them. Your heart will eventually lean towards only one, and you are the one to choose which it will be.
So we come again to the heart of the matter: What is within your heart will come out. Whatever has your heart has you. You are the one who decides what is in your heart and what has your heart.