Well, if you want to text someone anonymously on your iPhone, you can. But the iPhone doesn't offer you any direct option to send messages to anyone anonymously; instead, you can use third-party apps or VoIP and another app or website.
And when you send your message using iMessage or any social media app, it may show your ID, email, or phone number with the message.