In "for" it's possibl you were the one teaching him. With "to" it is clear someone else is teaching. It's more likely to be "his" swim lesson, insetad of "a" swim lesson.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.