How to convert a String o another Hex String

As @AWOL says, you are overwriting HexString each time you convert a character. Use sprintf() and strcat() together. Also as he says, the HexString is not sized for all the converted characters.

char msgArray[] = "example message";
//char HexString[20];
char HexString[sizeof(msgArray) * 2 + 1]; //2 nibbles/byte + null terminator
char tempChars[3];//2 nibbles/byte + null terminator

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.println(msgArray);
  for (int i = 0; i < sizeof(msgArray) - 1; i++)  {
    //sprintf(HexString, "%02x", msgArray[i]);
    sprintf(tempChars, "%02x", msgArray[i]);//hex string with two nibbles
    strncat(HexString, tempChars, 2);//append 2 chars
  }
  Serial.println();
  for (int i = 0; i < sizeof(HexString) - 1; i++)  {
    Serial.print(HexString[i]);
  }
  Serial.println();
}

void loop(){

}