I think the boundary between science fiction and non-SF gets a bit fuzzy in early works, but the Science Fiction Encyclopedia entry "Apes as Human" lists this 1817 story featuring an orangutan:
Melincourt, or Sir Oran Haut-ton (1817) by Thomas Love Peacock, where Oran Haut-ton saves a young maiden from rape, enters Parliament, and gazes wisely upon the human spectacle.
The full text is available here, but short of reading it, there's a summary here indicating that although the orangutan cannot speak, he shows signs of intelligence:
Despite his inability to speak, Sir Oran has learned to play the flute and the French horn and to imitate the manners of a polished gentleman. He finds himself completely at home in London society, especially at the opera, and his whole deportment is characterized by an air of high fashion. His prodigious strength and innate chivalry make him an ideal rescuer of damsels in distress. In fact he is the perfection of the "strong, silent type." When the heroine Anthelia is trapped on insular rock in the midst of a raging torrent, Sir Oran calmly sizes up the situation, then proceeds to uproot a large pine in order to bridge the chasm and carry her to safety. He foils one attempt to abduct Anthelia, and at a second attempt has succeeded he is instrumental in rescuing her from the wicked Lord Anophel Achthar, who has threatened to rape her if she will not marry him. Throughout the book he displays a strong sense of natural justice, along with various other attributes of the Noble Savage
This story was satirical and so it's debatable if it should be classified as science fiction, but the entry also mentions another story, published just a bit later in 1824, which it says was not intended as satire:
Charles Pougens's slightly later tale, Jocko: anecdote détachée des Lettres inédites sur l'instinct des animaux ["Jocko: Anecdote Extracted from Unpublished Letters on Animal Instinct"] (1824; trans Georges T Dodds as "Jocko" in The Missing Link and Other Tales of Ape-Men anth 2010), more directly connects the innocence of the orangutan Jocko to the doctrine of the Noble Savage espoused by Jean-Jacques Rousseau (1712-1778) ... Jocko is not a Satire
The plot description on p. 75 of The Apes of Wrath (it looks like chapter 3 of this book, starting on p. 73, would be a good source for early ape tales in general) describes it as
the story of an orangutan who falls in love with the novel's narrator. Unfortunately for Jocko, the narrator is greedy and forces Jocko to bring him precious stones. Jocko dies and the narrator returns to Europe a rich man.
From this description it's unclear if there are really any elements that could be described as SF, as opposed to just a mildly inaccurate portrayal of orangutan behavior.
Depending on whether you want to include fantasy or only science fiction, p. 74 of The Apes of Wrath mentions a much earlier candidate:
in the English Wagner Book (1593), an elaboration on the Faust legend, Faust's assistant Wagner is accompanied by an ape assistant, making explicit the traditionally implicit ties between apes and supernatural evil.