Why could I get a rash after swimming in a public pool?

Chemical sensitivity. You could limit severity by applying barrier cream to sensitive areas first.
Many factors. One of the factors is that the chemical used to keep the pool sanitary is the one that is causing you to have a rash. After swimming in that pool, rinse off well before getting dressed.