Apache kafka and RabitMQ have their own uses. A small discussion is given below.
RabitMQ is just a messaging tool which acts as a broker. It supports lots of protocols including, MQTT, AMQP, and STOMP. In earlier, It was one of the first open source message brokers that have a reasonable level of features, client libraries, dev tools, and quality documentation. The concept of RabbitMQ was originally developed to implement AMQP protocol, an open wire protocol for messaging with powerful routing features.
Apache Kafka is developed in Scala language and first introduced by linkedIn to connect different tools internally. It is basically used to data integration and realtime stream processing.