She enjoyed chatting with him.

Literal

She [topic-は] he [with-との] chatting [object-を] enjoyed.

との is a compound: と (with) + の (genitive/relativizer), used to attach a 'with X' relationship as a noun-modifier. 彼との turns 'with him' into an adjectival phrase modifying おしゃべり ('chat') — 'the with-him chatting.' This is how Japanese turns adverbial relations into noun-attached modifiers.