What is the error called when two letters are mistakenly swapped?

Solution 1:

That is called a transposition error, and is very common for reasonably speedy touch-typists. The text editor Emacs even has a basic control chord (Ctrl+T) to swap (transpose) the preceding two characters.

From Wikipedia's transcription error page:

Transposition errors are commonly mistaken for transcription errors, but they should not be confused. As the name suggest, transposition errors occur when characters have “transposed” — that is, they have switched places. Transposition errors are almost always human in origin. The most common way for characters to be transposed is when a user is touch typing at a speed that makes them input one character, before the other. This may be caused by their brain being one step ahead of their body.

Examples of Transposition Error

Input : Gergory Instead of : Gregory

Input : 23rd of Auguts Instead of : 23rd of August

Input : Johsua Instead of : Joshua

Solution 2:

Metathesis.

This word is most often used of swapping sounds, but the OED defines it as "The transposition of sounds or letters in a word, or (occas.) of whole words or syllables; the result of such a transposition".