Alliances are formed to achieve common goals. Italy, at that time a Fascist state, had much in common with Hitler's regime, and the Japanese were strong enough to keep Germany's enemies occupied, so the Axis agreement was signed in 1940. (It also included Hungary, Romania, Slovakia and Bulgaria.)
That didn't work out as well as the German High Command would have hoped for the Japanese attack on Pearl Harbor forced America into the war and THAT tipped the tables and ensured an Allied victory.
As for genocide, Hitler's "final solution" for what he termed "the Jewish problem" led to the extermination camps in which six million Jews were executed. They weren't alone, of course, and those camps claimed eleven million deaths in total. You can find a list of the non-Jewish victims AT THIS LINK.
But alliances are flimsy affairs and last only as long as they are convenient.