In addition to Stephie's answer, I'd like to add the following.
Bitterness in coffee is caused by overextraction, which itself can be caused by too fine a grind, pumping too much water through the coffee, a poor tamp, or a number of other factors. These factors all produce poor quality espresso.
One of these factors, roast level of the beans, means you will almost never get good quality coffee from a restaurant or cafe. The reason for this is that restaurants and cafes benefit economically from using longer lasting beans. Light and medium roasted beans retain more moisture than darkly roasted beans and so are more vulnerable to mold and general spoilage. This is why restaurants and cafes typically use very darkly roasted beans. Such dark coffee is chemically different from lighter roasts because of chemical changes caused by the roasting process's high temperatures, and the compounds that result from these changes taste more bitter than the compounds found in batches roasted to lighter roast levels.
One thing I want to explain: there are two ways of talking about "types of espresso". First, there are different drinks that use espresso as a base, such as latte, cappuccino, and macchiato. These drinks combine espresso with water, milk, or milk froth in varying amounts. In this sense, "espresso" means a standard ~30mL shot produced by pushing hot water through about 10g of very finely ground and compressed coffee. Then, to make the product server to the customer, an Americano adds hot water to the prepared espresso, a latte adds gently frothed milk, a cappuccino adds a layer of gently frothed milk and another layer of aggressively frothed milk on top, and a macchiato adds just a small splash of milk to "mark" the espresso.
Second, espresso itself can be prepared in different ways to produce standalone drinks or drink bases with names like doppio, lungo, and ristretto. These terms refer to the way the espresso itself is prepared. Doppio just means "double shot" and is prepared by using a double basket to prepare 60mL with ~18g of coffee to produce ~60mL of espresso all in one go. Lungo means the shot is pulled over a longer time and with more water, creating a larger volume result (~50mL). Ristretto is the opposite and means a shot pulled over a shorter than normal time, producing a lower volume shot (~20mL).
Hopefully this description can help you better understand what you're ordering next time.
Espresso should not be bitter ideally. But you can't reasonably expect "good" espresso at scale. Restaurants and cafes have to work at scale, so they are incentivized to use longer lasting beans over better tasting beans. Other factors like machine cleanliness, bean freshness, and employee skill may also not satisfy idyllic expectation.