Your heart is a muscle so you can think of it similarly to weightlifting. The more you work the muscle the stronger it gets. In the case of your heart, a stronger heart is more efficient and doesn’t have to pump as much when at rest. Marathon runners for instance have a much lower resting heart rate because their hearts are more efficient. There are even some mega-marathon runners with heart rates as low as 40bpm as compared to the average of about 60bpm.