Yeah you're right. It WOULD be pretty fucked up if you were a swan but you were raised by ducks and you grew up never seeing another swan or even knowing that such a thing as a swan even existed so you just thought you were a duck with something super wrong with it.
Ok literature history: the Ugly Duckling was written by Hans Christian Andersen, same guy that wrote Little Mermaid and many other very bleak fairy tales.
If the Little Mermaid is probably about his forbidden love for Edvard Collin (but that's another story for another time) The Ugly Duckling is undoubtedly the most unconsciously autobiographical of all Andersen's tales. It was conceived in July 1842, after the failure of his play The Bird in the Pear Tree, which was whistled at the premiere on July 4 of the same year, The Little Duck, begun at the end of July, appeared in October of the following year. Andersen reviewed the main periods of his life, his childhood in Odense (where he grew up very poor), the years of study, intimacy in the Collin family. The hen plays Mrs. Drewsen, eldest daughter of Jonas Collin.
It's the revenge of the poet (the swan) on ordinary people (the ducks), when he discovers an environment which allows him to recognize his talent.
It's a fuck you I'm awesome type of story.