The overhand knot is correctly called a "half hitch", the figure 8 knot is also referred to as a "stopper knot", and as name implies, it's used to keep your line from passing through a "fairlead" on a sailboat ⛵.
There's more information than you will ever want or need from a lifelong sailor...