How does the Assistant API use the metadata field?

The metadata field is purely an API affordance for you to store any data you want. A common example is to store IDs from your database, so you can have a connection between your user object / thread object and the one stored in the OpenAI API. It is not used for any API functionality and is not displayed to the model.