Americans place their hands over their hearts during the national anthem because it is the customary salute to the flag and anthem suggested by the country's flag code. The flag code was codified into law by Congress in December 1942.
The tradition of putting the hand over the heart came into being as a modification of Congress's first enactment of the code in June 1942. That law suggested using the Bellamy salute, in which people saluted the flag with their arms straight out and palms up. However, the salutes used by the Nazis and Fascists resembled the Bellamy salute, so Congress made the change.