Because it’s under pressure. Normal atmospheric pressure at sea level is about 14 pounds per square inch. That doesn’t sound like much, but if you put a vacuum pump on a sheet steel container and pump the air out… The container will collapse easily under that much pressure.
The bike tire is normally inflated anywhere from 50–60 pounds for mountain-bike tires to up to well over 100 pounds (per square inch) for road tires.
That’s sufficiently more than atmospheric pressure to keep the tire quite rigid and keep it in place on the rim of the wheel.