Why do men's bikes have high bars where you can hit your testicles while women's bikes have the bar much lower?
The tube is low on ladies' bikes for the skirt.
Otherwise, structurally, it is better to have the top tube higher. You can make the bike lighter with the same strength.
One should not be in a large danger of hitting the top tube with testicles or pelvis (which seems more likely to me and is very painful for either sex) if one selects the proper frame size with the correct standover height. Of course, if you are unlucky, it can happen, but there are many other ways how to crash and injure yourself that are more common.
Historically, the lowered/angled top tube was used relegated to women's frames so they could wear a dress or skirt.
However, in recent years this geometry has been reframed (HA) as "step-thru" since no one wears a skirt on a bike anymore (or at least if they do, it's no longer taboo to show your knees), and people with limit mobility (bad knees or hips) find it much easier to mount the bike. It's also just easier to get in and out of, especially if you have a child seat or other tall load in the back.
Meanwhile, the men's geometry is labeled "step-over" and is used on men's and women's frames in road and mountain biking, since it is a much stronger geometry.
Regarding safety of your testis... A good bike shop will set up with a bike that doesn't put your family jewels at risk. You should be able to stand over your bike with feet should width apart comfortably.
It's a mistake to think of bikes as gendered. Anyone can ride any bike, within some limitations, and physiological differences within genders vary greatly. Find a bike that fits your body correctly. If a bike with a high, straight top tube causes you to hit your testicles, consider choosing a bike with an angled top tube or an open frame design. Your gender will not matter to the bike.