Oracle's feud with Google goes all the way back to 2005 in some way or another, which explains some of why it has become the circus of craziness and courtroom posturing that it is today. A long history, though, doesn't fully explain why this case has evolved into an all-out war with $9 billion and the future of open-source software and API, the bits of code that allow different programs and languages to communicate, at stake. That story is a lot more involved; a sticky tale of software compatibility dependencies and the moral question of what "fair use" is and what licenses in the open source world it may or may not apply to, as well as what particular bits of code may be copyrightable, even if they originated under such licenses.
Back in 2005, Google originally bought Andy Rubin's Android startup. During the development of Android leading up to the release of the HTC Dream in 2008, Rubin was in talks with Google about how to approach development, whether it should be through the C++ language or the widely used and easy to use Java language, of which only some parts were open-source and license free. In the end, after trying to negotiate with Sun for a full license and never quite reaching an agreement, they went with Java but decided to try to avoid using non-free components by creating a Java-compatible virtual machine, called Dalvik. In 2010, Google was beginning to see Android hit its stride. This is about a year after Oracle bought out Sun and inherited Java. All of the parts of Java that Google was using were covered under applicable open-source licenses, but the question of the day was whether some custom-developed parts, the APIs, could be used freely. In July of that year, Oracle and Google met up to discuss legal implications and allegations of copyright infringement. Google begins looking into alternatives to Java, but can't find anything suitable. Thus, Oracle goes forward with a lawsuit later in that year. After Google gets some of Oracle's patents thrown out on the grounds that they should have never been issued, the two appear in court multiple times, with damage estimates being adjusted constantly, and are even court-ordered to have their CEOs meet to discuss settlement. That talk and many others about settlement wound up breaking down, leading us to where we are today.
Now, to give some detail about the technologies at the center of all of this; Since its inception, Java has been a free and open-source system, for the most part. A few APIs and bits of code here and there belonged strictly to Sun. Java, with its ease of use and wide compatibility, had become a cornerstone of the software world by the time Android was even a twinkle in Andy Rubin's eye. The APIs, which are at the center of the case, are bits of code that allow software to work together. Through APIs, Java code can communicate with hardware and software that would otherwise be incompatible. The APIs also dictate ways that Java code can perform some advanced functions that the normal code would either be unable to accomplish on its own or would have a very hard time accomplishing and cause headaches for any programmer bold enough to try. APIs, obviously, take some effort to create. The APIs in Java are mostly under open-source licenses, but, due to their nature as not being a native part of the programming language, could be copyrightable if the creator so chose. Naturally, this led to most companies that used these Java APIs for commercial purposes getting a license. To understand why the question of how enforceable an open-source API's license may be or if one could ever be required, you have to understand a bit about open-source licenses. There are a large number of different open-source licenses out there, but what they basically all dictate is that parts or all of the code under license can be reused or changed around.
The question at the center of the trial right now is how far fair use, the use of licensed and open-source content, can reach. Mostly, fair use is centered around creative works, such as cover singers on YouTube or fan fiction of famous books. For the most part, fair use projects don't end up making money. Google argues that their use of Java, in all forms, constitutes fair use. While Android made Google's search and other services into juggernauts and earned them huge sums of money, they never actually sold Android itself and made it strictly open-source. This means that a fair use defense could technically be valid. If it is found, however, that APIs can actually be subject to copyright, that defense falls apart and becomes blatant copyright infringement, at which point Oracle can take the damages for punitive measures, time in court and, of course, the money they would have made on licensing if Google had licensed Java instead of going with open-source and fair use. That all said it's quite easy to see how a win for Oracle in this case could jeopardize the open-source nature of APIs and call the nature of fair use into question. This means that software development of all spades could become much more complicated, costly and more frequently litigated.