Series pass transistor, LM7812
Here is the diagram from page 20 of the datasheet you linked:



Image source: Fairchild LM78xx datasheet, Figure 13

Notice that the pass transistor is PNP. The mistake in your design, is that you are trying to use a 2SD1047 NPN pass transistor - which won't work, as you have seen.