Custom Detail in Salesforce Chat

The Custom Detail is displayed to agents in the footer widget and in the Chat Details page in the Salesforce Console while the chat is active. So, the Custom Details will be displayed only when the chat is active.
Reference Article:
https://developer.salesforce.com/docs/atlas.en-us.214.0.live_agent_dev.meta/live_agent_dev/live_agent_customizing_visitor_details_API_addCustomDetail.htm

It is not currently supported in Lightning Experience. You can vote for this idea.
https://ideas.salesforce.com/s/idea/a0B8W00000GdVh7UAF/prechat-information-provided-when-initiating-the-live-agent-chat-is-not-visible

Workaround:
You can create fields in Chat Transcript object. In the Pre-chat Visualforce page, you can use saveToTranscript() to store the values directly on the Chat Transcript record.
Sample code:
liveagent.addCustomDetail('Company', 'Acme').saveToTranscript('Company__c');