This can be done in many ways but have you tried for example something like (translated from your description):
INSERT INTO Table2 (Class, Math, Physics, ...)
SELECT Class,
CASE
WHEN Class = 'VI' THEN (SELECT SUM(t1.Math) FROM Table1 t1 WHERE t1.Class = t.Class)
ELSE 0
END,
CASE
WHEN Class = 'V' THEN (SELECT SUM(t1.Physics) FROM Table1 t1 WHERE t1.Class = t.Class)
ELSE 0
END,
...
FROM Table1 t