In a few cases, an essay and a composition can mean the same thing. However, your composition for a music class will look much different than your composition for a history class.
An essay is an informative piece of writing that includes an introduction, a body, and a conclusion. The purpose of an essay is to present a specific point that a writer has chosen to make on a topic and to lay out the reasoning for why the writer reached that conclusion. When the writer has completed their essay, they have in their hands a literary composition. Essays can only be completed using the written word.
A composition is any creative work, and creativity does not always come in the form of the written word. Written compositions can be essays, but there are many other forms of writing that fall under the definition of a composition. In fact, all original pieces of writing are defined as written compositions, including all the writing forms that are not essays. Compositions can also include many other forms other than writing, as well.
Essays come in four basic types: expository, persuasive, descriptive, and narrative. Expository essays present facts about a topic, persuasive essays argue a point and try to convince readers to agree on that point, a descriptive essay paints a story using words, and a narrative essay tells a true story from a writer's personal experience. Each type of essay has its own structure to be followed but all should analyze, present, or describe a specific topic.
Compositions come in many forms: plays, short stories, musical scores, art, novels, and poems. Each has their own requirements for structure and allowances for creativity. Any original creative work is a composition, whether it's written, performed, sculpted, or drawn. Both modern American author Stephen King and 16th Century music composer Wolfgang Amadeus Mozart are known for famous compositions like the novel The Stand and the opera The Marriage of Figaro.
While you don't need to be a great writer to publish a composition that will make you famous someday, you won't be able to take any shortcuts on learning an art form and honing it through years of practice. Whether your practice includes a pencil, word processing software, a paintbrush, or a piano, the original and creative results of that practice will all be compositions.