Though on-chain transactions secure data, off-chain transactions are used mainly to protect the privacy of the data and that's why it is made between two trusted parties and is not visible to the public. And because these transactions do not need validation or verification by other nodes or miners, it is cheaper and faster.