Might be because there are less Swift projects to train with.
But I've seen Claude write crazy code in Python and JavaScript, too
I do not know about crazy, but certainly sub-optimal. For example a loop over DB query results instead of modifying the code to work with a single query.
My theory is that most of the Swift code in the public domain, is basically demo code. Short, idealized, code samples to demonstrate issues and solutions; much like you would see in StackOverflow.
PHP has huge, entire frameworks and systems, refined over years.