In The Friendship Algorithm (2009) it is very firmly established that Sheldon never truly learned to swim. He "learned" to swim as an intellectual exercise from the internet and practicing on the floor, citing that he has no interest in actually entering water. Leonard describing it indicates he witnessed this, it was during their time as roommates, as an adult. Here a young Sheldon is shown swimming in the pool.
Sheldon is told that swimming is a State requirement and to address his complaints to his congressman. Congress does not set State matters, that would be the province of his Assemblyman.
Although it's stated that the swim test is a state requirement, and thus is taught in schools where Sheldon lives, it is quite possible Sheldon skipped past the grade where they would have taught him.
In this episode they are preparing to decorate for Christmas, but this is only one episode after the episode where Sheldon received the Star Trek Fan Club magazine dated April/May 90. That means this episode takes place at least 6 months after the previous episode. This also means that Sheldon's 11th birthday is only 2 to 3 months away.
When Sheldon goes to the principal to try to get out of the swim test, the principal says it is out of his hands, it is a state requirement, and if Sheldon still wants to dispute taking the test, he should take it up with his Congressman. Sheldon would certainly know that a Congressman is a federal elective office, and he would immediately point out the principal's error and explain that the state office which Sheldon should complain to if he wishes to dispute the necessity of taking the test is the Texas Education Agency (TEA), which is the branch of the government of Texas responsible for public education. In the alternative, Sheldon would also certainly point out that he could also speak with either his elected member of the Texas House of Representatives or his elected member of the Texas State Senate, and add that this is all information which any school principal should know. In this instance, Sheldon adds to the error, when the school principal says Sheldon should call his Congressman, Sheldon says he already did, and they won't talk with him, as they should not, being a federal office and federal office holder, having nothing to do with Texas State education policy.