Why do the bars touch on a histogram but not on a bar chart?
Because there is a difference in the kind of data you present.
In a bar chart , you compare categorical, or qualitative data. Think of things like eye colour. There is no order in them, like green is not 'greater' than brown. In fact you could arrange them in any order.
In a histogram , the values are quantitative , which means they can be divided in ordered groups. Think of height or weight, where you put your data in classes, like 'under 1.50m', '1,50-1.60m' and so on.
These classes are connected, because one class begins where the other one ends.