We should remember first of all that Japan had a sort of alliance with Germany before it ever entered the war. This came about because Germany and Japan were both unhappy with the international order after WWI and wanted to change it.
However, when looking at Japan’s actual entry into the war in December of 1941, the most important factors have to do with German successes in Europe. By December of 1941, Germany controlled all of Western Europe. This meant that England was effectively tied down and would not be able to do much to resist Japan in Asia. By that time, Germany had also invaded the Soviet Union and it still looked as if that invasion would be successful. At the very least, this kept the Soviets tied town and made it much less likely that they would attack Japan. With Germany looking like a sure bet to win and with two of Japan’s most important enemies neutralized, it seemed like a good idea to enter the war on the Axis side.