A council has been fined £75,000 after a four-year-old boy nearly drowned during a swimming lesson.