The names Pythagoras and Plato are associated with methods of generating Pythagorean triples due to their mention in Proclus's commentary on Euclid. However, as far as I have been able to determine, there is no mention of such a method in the extant works of Plato, and, as has been mentioned in the comments, attribution of any mathematical result to Pythagoras or to the early members of his school is problematic.
In his commentary on the proof of the Pythagorean theorem in Book I of Elements, Proclus describes two methods for generating Pythagorean triples, stating that one is attributed to Pythagoras, the other to Plato. Using an anachronistic algebraic formulation, the "method of Pythagoras" yields the triple
(n,n2−12,n2+12)
for any odd integer n. Examples are (3,4,5), (5,12,13), (7,24,25), (9,40,41), and (11,60,61). As two elements of each triple differ by 1, these are clearly primitive.
The "method of Plato" yields
(n,(n2)2−1,(n2)2+1)
for any even integer n. This is equivalent to the formula you ask about. Examples are (4,3,5), (6,8,10), (8,15,17), (10,24,26), and (12,35,37). If n is twice an odd number, the method yields the same triples as the "method of Pythagoras", but doubled. If n is twice an even integer, the triples are primitive as two of their elements are consecutive odd numbers.
The passage in the question starts on page 340 (location 428.6) in Glenn R. Morrow's translation of A Commentary of the First Book of Euclid's Elements. Here it is:
Certain methods have been handed down for finding such triangles, one of them attributed to Plato, the other to Pythagoras. The method of Pythagoras begins with odd numbers, positing a given odd number as being the lesser of the two sides containing the angle, taking its square, subtracting one from it, and positing half of the remainder as the greater of the sides about the right angle; then adding one to this, it gets the remaining side, the one subtending the angle. For example, it takes three, squares it, subtracts one from nine, takes the half of eight, namely, four, then adds one to this and gets five; and thus is found the right-angled triangle with sides of three, four, and five, The Platonic method proceeds from even numbers. It takes a given even number as one of the sides about the right angle, divides it into two and squares the half, then by adding one to the square gets the subtending side, and by subtracting one from the square gets the other side about the right angle. For example, it takes four, halves it and squares the half, namely, two, getting four; then subtracting one it gets three and adding one gets five, and thus it has constructed the same triangle that was reached by the other method. For the square of this number is equal to the square of three and the square of four taken together.
Morrow refers the reader to pages 356–360 of Volume I of Heath's translation of Elements, where Heath presents some speculations on how such methods might have been discovered. Starting on page 360 Heath also discusses at length the early knowledge of the Pythagorean theorem and Pythagorean triples in India that is exhibited in the Śulvasūtras.
Interestingly, in the paragraph preceding the one quoted above, Proclus discusses isosceles and scalene right triangles, echoing Plato's classification in Timaeus. But among scalene right triangles, Plato singles out the 30∘-60∘-90∘ triangle, for which, as Proclus notes in the case of the isosceles right triangle, "you cannot find numbers that fit the sides"—so nothing there about Pythagorean triples. Later in the paragraph, Proclus says that there are scalene triangles for which "it is possible to find such numbers", giving the example of "the triangle in the Republic, in which sides of three and four contain the right angle and five subtends it". In a footnote Morrow says the allusion is likely to Rep. 546c. In my reading that passage engages in a complicated numerology involving the numbers 3, 4, and 5, but does not say anything about right triangles. If somewhere in Plato there is a mention Pythagorean triples, that would be interesting, but I have not heard of such a passage.