MQTT is a standard protocol (with many implementations). Kafka (which is also a protocol) is normally used by downloading it from the Apache website or e.g. a Confluent Docker image. Both exist for very different reasons.
It is like comparing apples and oranges,
Most use cases I see in IoT environments combine both MQTT and Apache Kafka. The edge devices speak MQTT protocol (for the benefits it has in edge environments. These are then forwarded to Apache Kafka to get the events into the rest of the enterprise architecture.
You can do this either via an MQTT Broker like HiveMQ + Apache Kafka or via an MQTT Proxy (so that you don't need the MQTT Broker). Both options have their own advantages.
Hope this works for you!
Get your Kafka certification today to become certified professional
Thank You