It’s generally not taught by default in US schools, but some schools offer it as an elective and/or as a competitive sport. Maintaining a swimming pool is an expense that many schools, especially in poorer districts, cannot afford. Outside of schools, there are sometimes community swim classes at places like the YMCA, but those require the parents to be actively involved (like with many extracurricular activities) and usually are an additional expense.
Physical education is usually a mandatory part of US schools through high school (where students graduate at around age 18), and schools often offer students a selection of sports for PE - I did fencing one year and wrestling, gymnastics, and archery other years - but swimming requires more infrastructure than a basketball court and some padded mats.