A square is drawn inside another square, with the inner square being rotated slightly so that its corners divide sides of the outer square into lengths ‘a’ and ‘b’.

For those four triangles at the corners, two of them can be put together to make a rectangle with sides ‘a’ and ‘b’ having an area ab, thus four of them gives the area 2ab. The area of the inner square is c^2.
The area of everything is calculated from (a+b)^2.
(a+b)^2 = a^2 + 2ab + b^2
We thus have two ways of calculating the area of everything and we can make these calculations the two sides of the equation.
2ab + c^2 = a^2 + 2ab + b^2
When we cancel the 2ab terms we have:
c^2 = a^2 + b^2