Look at the color of the two specimens. The actual gold, on the left, is a yellower color and dull in appearance. The fool's gold is too shiny and way too bright. The weight is another clue. The piece of gold is much heavier than the pyrite.
Gold is also much softer than the pyrite.
If you took a piece of gold and hit it with a hammer, it would just flatten out. Pyrite would bust into a puff of dust. There is also the hardness test, which you determine by scratching the specimen with a nail or a hard rock. The gold will carve, the pyrite will crumble. When you are panning, and you get down to the black sand, there may be gold and pyrite in with the black sand.