why we should have integration layer and data layer separately?
It’s more a design question than really a pega specific question.
The short answer
Services to exchange data are contracts, and contracts are fixed to make it easier to work with (micro)services architectures.
The longer answer
The internal data structure (data layer) is modeled to your companies requirements. This is different for each company and most likely even between applications within the same company. A data structure is usually a sort of living organism and changes over time.
An external data structure (integration layer) is modeled for consumers. This is a data structure used in integrations and is a contract on how to exchange data between different applications.
In an environment where services are used to exchange data between systems you want to have fixed contracts that do not change frequently. Every change made in a contract (integration layer) forces all consumers to make the same change.
If your internal data structure (data layer) is used as external data structure (integration layer) as well, then you either cannot make any changes to your data layer (without violating your contract), or you cannot have a fixed contract and are a very unreliable service provider.
Think about this the other way around as wel. When you consume a service, you don’t want to make a change every week, just because the service provider made a change to its internal data structure.
Also don’t use the service contract data as your internal data structure. Any change to the contract forces you to change your data layer.
So, we have these two different layers because we want to be flexible. Flexible in changing our internal structure without violating the external service contract. And flexible enough to consume another version of an external service without having to change your internal structure.