So if the universe expands, wouldn't that create universal cooling?
I think the boundary conditions need to be considered.
Yes; that explains how the Universe starts out in a hot condition at the "Big Bang" and cools to its current observed condition without shedding heat to an external heat sink. It's a gigantic adiabatic cooling process that is the consequence of the expansion of space.
A star is just the opposite: a gravitational contraction of gas and dust heats up the matter. If there is enough matter (more than 0.1 solar masses) undergoing adiabatic contraction, it gets heated to the point where nuclear fusion reactions begin deep inside, and star is formed.