Just to add, everything expands as it heats up.
water expands about 4 percent going from say 70 degrees to 212 degrees F.
so for 3 gallons of coolant, assuming all water, it adds about .12 gallons of volume of water to the system.
That increases pressure in an enclosed space, tipping past the say 12 or 15 pounds the cap is supposed to hold and bleeds out into the overflow tank.

When it cools that volume contracts the same amount, causing a vacuum to form in an enclosed space. So it then sucks air or coolant back through that tube.
You can look up the density of any material by temp to do the math on how much something expands or contracts due to temp of that item.

to take it back to cars, they didn't do the math right on the phenolthaic pistons they used in the calipers back in the l80's and when they heated up they jammed in the calipers.
had one seize up in an 83 m-body and had to power it into the garage smoking the whole way.