Hi Daniel,
Great that you are interested in MQTT!
When you client is trying to connect to the broker and receiving the CONNACK message with response code 5, this means that the client has connected but was not authorised for some reason. Most often it is a wrong username or password.
To get better help here, please share your connection details and the full text of the error message you get.
Thanks,
Dasha from HiveMQ Team