I understand that both CDC and Platform events are based on Event driven architecture, and there is a common event bus(though different channel) where both kind of events are published. Since, event bus is common, we can subscribe to each channel in same way. The difference I understand is in the way the messages are published to the bus, since in CDC salesforce published the messages in a format, and in PE the application has to explicitly define structure and publish message. However, in some document(like https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_trigger_intro.htm) I read that CDC is based on PE. I am kind of confused here. It is on event bus for sure, put why on PE.
There's several layers involved here.
First, there's CometD/Bayeux protocol, a generic protocol for streaming data from a server to a client. Having a standard means that everything is well documented and implemented in many languages, and leverages standard technology.
The next layer that's Salesforce-specific is the Streaming API. It's used for any application where the server is expected to push continual updates to a client, and uses CometD as its protocol. For example, you can set up a query to monitor for specific changes or for specific records.
Next are Platform Events (PE), which allow for an Enterprise Service Bus (ESB), but unlike the general Streaming API, it allows events to be pushed from various sources to any clients that are subscribed.
Finally, CDC is a specific PE channel that is used to notify subscribers of new records and changes to existing records, and has specific features in Salesforce tied to this feature.
CDC takes advantage of the already-existing PE architecture, which in turn takes advantage of the existing Streaming API architecture, which is based on a standard protocol that has libraries in various programming languages. All of this reuse allows for rapid development and deployment of new features.