In the 1970s DC and Marvel published Superman vs. the Amazing Spider-Man. While it wasn't the first time that Marvel and DC had had their names on the same comic - the honour goes to a Wizard of Oz adaptation, it was the first time that the modern era Big Two had their heroes meet. However, it wasn't the first intercompany crossover. In fact what I believe to be the first intercompany crossover, while frequently discussed in comic book histories for other reasons is rarely described as an intercompany crossover.
Note: I did use Wikipedia to flesh out a few details but had
already made my conclusions prior to starting on this article.
To realize what was the first intercompany crossover, you have to look back to the earliest days of the American Comic as we know it. In the earliest days of the tabloid comics, the stories were all reprints. But it didn't take long before Major Malcolm Wheeler-Nicholson created National Allied Publications to produce new material. New Fun Comics (later More Fun Comics) became the first ongoing series to be devoted to new material (after first testing the waters with the one-shot New Fun: The Big Comic Magazine #1). It was followed soon after by New Comics (later New Adventure Comics, later Adventure Comics). In order to publish a third title, Nicholson, now in debt to accountant Harry Donenfeld, actually created a second comic company, Detective Comics, Inc. with Jack S. Liebowitz as his partner. This company, in 1936 published Detective Comics, then Action Comics in 1938. Action Comics #1, which had the debut of Superman is generally credited with the creation of the comic book superhero, though an argument could be made for Dr. Occult in New Fun Comics #6. National Allied Publications and Detective Comics inc. later merged as National Comics.
Prior to this merger, however, another company with close ties to National was formed. In 1938 Max Gaines (later founder of EC Comics and father to William Gaines, who co-created Mad) created All-American Publications, which Donenfeld also provided funding to with the condition that Liebowitz be taken on as his partner. Unlike Detective, All-American had a different physical location. There were close ties to the companies (both had DC on their cover at one point) but despite their close relationship were separate companies (in fact there was a point where things cooled between the two enough that All-American had its own separate logo on the covers). All-American's best known titles were probably All-American Comics (which had the debuts of Green Lantern and the Atom) and Flash Comics (which in its first issue debuted The Flash and Hawkman).
Both National and All-American continued to create new heroes. All-American published All-Star Comics #1 in 1940. All-Star Comics #1 had all-new strips of superheroes from both National and All-American, though like most comics from that era, characters from the different strips never interacted. That all changed with #3. In #3 characters from different strips (a somewhat different line-up from #1) were depicted as socializing together as the Justice Society of America. The original roster of the Justice Society included National characters Hour-Man, Spectre, Sandman, and Doctor Fate; and All-American characters Flash, Hawkman, Green Lantern, and Atom. In this story they never actually teamed up, just talked about their exploits. However, in #4 the team learned about a crisis and each character worked on a different part of the case before teaming up in the final chapter.
All-American was absorbed by National in 1944 and soon became National Periodical Publications, a name which was used until 1977 when it become DC Comics. However, at the time that All-Star Comics #3-4 came out, National and All-American were separate companies. So All-Star Comics #3, aside from being the first superhero team comic, was also the first intercompany crossover in terms of superheroes hanging out together, with #4 being the first time characters from two different comic book companies actually worked on the same case together.