Basil is one of the most commonly used herbs in the world, and the best tasty cooking substitutes for basil depend on the type of recipe and what type of basil you're trying to replace. Native to Asia and Africa, basil is a common part of Mediterranean and Southeast Asian cuisine, including Italian pesto and Thai stir fries. Basil is a hardy perennial plant that's easy to grow, which has probably contributed to its spread and popularity.
Many Asian recipes call for sweet basil (a.k.a. Thai basil or Asian basil), which has a sweet flavor and stands up better to cooking than European varieties. In this context, remember that basil is a member of the mint family. While fresh mint leaves might not meld well in an Italian pasta sauce, mint leaves are common in Thai cooking and other South Asian cuisine, and are often a good substitute for the flavor of sweet basil in stir fries. You could also substitute regular basil for a milder flavor.
Fresh oregano, tarragon or summer savory make tasty substitutes for basil. However, the flavor can be quite different. Tarragon has a licorice-like flavor, while summer savory is slightly spicy. In dishes where one of these herbs already has a strong presence, such as oregano in Italian tomato sauce, you might increase the amount slightly to make up for the lack of basil.
In dishes where basil has a strong presence, such as pesto, it can be difficult to find a tasty substitute. Fresh cilantro or a combination of parsley and celery leaves could work, but won't have the same kind of flavor.
The flavor of dried basil is much less strong and distinctive than fresh, so it's easier to find a tasty substitute. Depending on the recipe, try an equal amount of tried oregano, marjoram, tarragon or thyme.