LVmotoJock saidWear a jockstrap. Keeps the boys in place.
Men had that same problem when biking became popular in the late 1800s with the introduction of the diamond frame and chain drive. So a US guy invented the athletic supporter (jockstrap) for male bikers to wear, and named his new product and company - Bike, with a spoked bicycle wheel as its logo. The brand is still around today.
Balls shouldn't hurt when using a stationary bicycle. A jock isn't essential, most modern snug briefs will work as well on a saddle. But going commando or wearing boxers will cause pain for some men.
Also, stationary gym bikes have a quick-adjust lever for seat height, and some also for fore and aft adjustment and tilt. The seat, user adjustable or not, may have been at the wrong angle, the front raised too high, and the gym needs to be notified if its readjustment requires tools.
The best beginning angle for a bicycle seat is perfectly horizontal, the top surface parallel to the ground. Over time a man with a privately owned stationary or road bike may find that a few degrees of tilt suits him best, along with fore and aft changes. The biggest problem I see on all bikes, indoors or out, is having the seat post set too low. Guys are trying to pedal with their knees practically hitting them in the chin, which is bad for the knee joints, and maybe can hurt their balls, too, I dunno, I never pedal that way.
I'll ride 100 miles in a single day, getting jolts from the road through a hard, narrow saddle, and my balls never hurt. My crotch may get a bit sore, though, partly from friction chaffing. There are anti-friction protective creams just for bikers (aka chamois cream, body glide, etc), and of course biker shorts with a padded crotch chamois sewn in, though really not needed for 30 minutes on stationary gym bikes with their broad comfort saddles.