Made of electrum, a mix of silver and gold, the earliest known coins were minted in the seventh century BC in the ancient Kingdom of Lydia (ref 1), according to the British Museum. The coin you found while digging in your backyard may not be as old or rare as a Lydium coin, but it can be intriguing, leading you to want to find out more about it, including its value.
Examine the coin to decipher its age, country of origin and condition. Use a magnifying glass or loupe to look for intended marks, such as a date, and for unintended age marks, such as scratches and worn spots. According to the coin collecting website 2-clickcoins.com, you should use a loupe with 5x to 7x magnifying power or better. (ref 2) Looking at a coin through a magnifier won't make you an expert in evaluation, but it will reveal hard-to-read details and give you a fair idea of the coin's condition or grade.
Once you have a good idea of condition, consult various price catalogs to get a ballpark idea of value. Look for two different prices: the price a dealer would charge you and the price a dealer would pay. You can buy the catalogs or find them at the public library. Some guides can even be found online. (ref 2)
Browse coins shops and collectors' shows to further educate yourself and compare your coin to others.
If you believe you have a coin of value, bring the coin to a reputable dealer to have it appraised. You will have to pay a fee, but an appraisal is the best way to determine value. If you take it to dealers asking what they will give you for it, they may give you a price that suits them because you are not offering to pay for an appraisal. If you have doubts about the appraisal, get a second appraisal.
If you find out that your coin is very valuable, arrange for a fine arts auction house, such as Sotheby's, to appraise it for you.