In order to understand where hearts came from, we have to go back to the earliest common ancestor of everything that has a heart. It took hundreds of millions of years, and countless different iterations of the same basic structure to lead to the heart that you have today.