I'm no expert, but based on what I've found, I think your teacher (or textbook) was just oversimplifying the system.
This page, from the Washington University in St. Louis's law school, says:
After two weeks of oral argument, the Court breaks from that routine to work on writing opinions. To this end, at the end of each oral argument period, the Chief Justice circulates an assignment sheet, which lists the cases for which each Justice is tasked with writing the majority opinion for the Court. When the Chief Justice is in the majority at the conference discussion, the chief has the prerogative to assign the task of writing the majority opinion to another Justice in the conference majority. When the chief Justice is in the conference minority, the senior associate Justice in the majority makes the opinion assignment. The assignment sheet clearly denotes which Justice made the assignment.
Similarly, the SCOTUSblog's educational resources section says:
The senior justice in the majority (that is, either the Chief Justice or, if he is not in the majority, the justice who has been on the Court the longest) decides who will write the majority opinion; if there is a dissent (an opinion held by a minority of Justices that a different decision should have been reached) then the senior dissenting Justice decides who will write the lead dissent to the opinion.
So in other words, the Chief Justice always decides who will write the opinion for the side he favors, but he doesn't always write it himself (that would be a lot of opinions for one person to write), and he also doesn't decide who writes the other side's opinion.
It's not directly part of answering your question, but the next paragraph from the WUSTL's page is also interesting (emphasis mine):
The assigned author then begins work on a draft opinion. Justices either take the lead in writing a first draft or delegate that responsibility to a clerk. Even in the latter case, the Justice will play a major role in drafting the opinion. When the Justice is satisfied with the draft, he or she will circulate it to the other Justices. At this point, Court custom is for Justices to respond to the opinion draft by "joining" the opinion, expressing reservations with the opinion draft, indicating that they plan to write a separate opinion, and so on. This interaction occurs in memos written to the author with a copy usually sent to the other Justices (what they call the Conference). At the end of this process, each Justice will either write or join an opinion. When every Justice has joined or authored an opinion, the Court announces its decision to the public.
It's quite possible (albeit highly unusual) for every justice on the Court to write their own opinion for a case. Some will be individual dissents, and others will be concurring opinions, which usually indicate that the justice writing it either agrees with the decision, but not the reasons, or that they only agree with part of the decision. When there's less than a majority for one opinion, the one with the most justices is the "plurality opinion" of the Court, and actually determining what the Court's ruling means gets complicated.