It is a baseball reference. You swing a bat. If three strikes are counted against you, you are out. (metaphorically, you die). If the ball crosses over the plate between the levels of your knees and your shoulders, it is a strike, unless you swing your bat and hit the ball. You still might be counted out, because baseball is a complicated game, and I don't want to go through all the rules here.
Anyway, it is considered embarrassing to not even swing at the ball, and be counted out on strikes. Many batters strike out often, especially the ones who go all out for it trying to hit home runs. It is definitely more noble to "strike out swinging."