In foods like pastries, the "crust" is generally the part made of bread or something similar. In a pizza, the crust is the bottom layer, usually made of bread or something similar, on which you put any cheese, sauce, and "toppings".
In the above picture, the crust is underneath and on the sides of this pepperoni pizza. You may also notice it's a "cheese-filled" crust, meaning the outer edge has a hollow center filled with melted cheese.
In a pie, the crust is the outer "shell", that goes up the sides and sometimes completely covers the top:
In the above picture, the crust is what encloses the "filling" of the pie. Here it's a full crust that completely covers the top, but in others it can be a "lattice" crust that forms a pattern over the top, or no top crust at all.
In bread, "crust" refers to the (usually harder) outermost layer.
In the above picture, the crust is the brownish part around the softer yellow part. For example, some people like to cut the crusts off of their sandwiches before eating, preferring only the soft part of the bread.
Lastly, there are other foods that have a crust that is not made of bread but simply harder than the rest. For example, a crème brûlée is a dish of custard where the top part has been caramelized (melted with a hot flame) into a hard shell.
In this dish the crust or shell is the thin top layer which you crack to get to the custard underneath.
"Crust" is not only used for food. It can be any hard or solid substance that forms on the edge or top of some other substance, usually a liquid. For example the outermost layer of the Earth is often referred to as the "crust", as it is outer to the semi-liquid "mantle".
Side note: Now I'm hungry.