Trieste is located in the north-eastern tip of Italy, and seems to be digging into Slovenia. Why does it belong to Italy instead of Slovenia?
Originally, all of Istria belonged to Italy, and was only ceded to Jugoslavia after the Second World War (this is objectively one of the least-worst maps I could framing Italy in 1920 Europe).
Although for the sake of completeness, it's important to note how the 1871 borders of the Kingdom of Italy actually do not include much of modern Northeast Italy; that is because the northeast was only acquired through a series of opportunistic conflicts between the Austrian Empire and the much smaller Kingdom of Piedmont over the course of the Italian Wars of Independence (more accurately called "Wars of Unification," but I digress). You can see Italy's pre-unification borders here; the northeastern polity called "Regno Lombardo Veneto," or "Lombard-Venetian Kingdom," was a constituent state of the Austrian Empire and didn't even contain Istria and Triest in its borders. The fact that the conflicts between Piedmont and Austria could only really be successful under very specific circumstances (i.e. if the Austrian Empire was already fighting a great power, or a great power went so far as to back Piedmont) meant that the acquisition of the northeast was piecemeal and driven by opportunism.
That's not to say the acquisition of the northeast wasn't a stated goal of the nascent Kingdom of Italy; in fact, it continued to be a goal even after the acquisition of Venice. Italian irredentism, although a largely unfocused movement, actually claimed an even larger portion of the dalmatian coast, as you can see in this newspaper vignette from 1918.
The precedent for those claims lie in the historic borders of the Republic of Venice; as you can see here. However, the situation on the ground was a bit more complicated. Although the Piedmontese drive to unite Italy was, in part, driven by exiles from the other Italian states, the multiethnic nature of Istria and Dalmatia meant that nationalist sentiment took a more complex dimension and Italo-Dalmatian exiles were much less numerous, if not absent. That is mainly because although some, if not most, of the coastal urban elites were Italian-speakers, much of the ordinary population wasn't. You can see the locations of Italian-speaking populations in this representation of the 1910 census.