Why does tanking at something mean failing at it?
As an example:
Mate, I tanked that maths exam.
Tank came from Tennis jargon, by way of boxing jargon. Originally, it meant to lose on purpose to gain an advantage. You could tank a set to get a rest or tank a boxing match so your backers could make money gambling against you.
According to this Slate article, in the 19th century, Americans called swimming pools "tanks" and thus "go into the tank" was synonymous with "to dive."