The answer is about history and harmonic series, but it varies between Brass and Woodwind to some extent.
Historically, Brass instruments didn't have valves, but were tubes of fixed length, with additional loops of tubing call crooks that could be inserted. These would allow the player to play notes only in a particular harmonic series, which corresponds to a particular key.
By saying horn in F, you would tell the horn player to add a suitable crook such that they could play the harmonic series based on F. You could write horn in D and they would put in a slightly longer crook to play notes in that key. The key of the instrument was normally specified to match the key of the piece, or a particular passage. Sometimes extra players were added in a different key to fill in notes.
Music was transposed to match that harmonic series, so the player would always see C, E, G etc. in their music and know which harmonic was needed.
Eventually valves were invented and added, but the convention of writing in the key matching the harmonic series and musical key stuck because the players and composers writing at the time already understood this. As the length of tubing became more standardised around a particular harmonic series (F for horns, often but not always B flat for trumpets) these transpositions in scores also stuck.
Trombones have been chromatic instruments with slides for as long as they have been in orchestras and as such their parts have always just been written in concert pitch. They have been written in various clefs to make writing in their range convenient for the composer and player. Similarly, tubas were chromatic since their invention, so weren't transposed. Brass bands have sought to simplify learning many different instruments, so have brought the convention of fitting to the harmonic series, a common fingering pattern and treble clef to almost all instruments. This means that the player needs to only get used to a different embouchure or the difference between slides and valves when switching instruments.
In Woodwind, key systems are now quite advanced and allow the instrument to play well in all keys. However, this wasn't always the case, and so Clarinettists needed multiple instruments to achieve the best musical results (the instruments were fully chromatic, but I gather that some accidentals did not play quite as cleanly as others). The B flat and A Clarinet covered many keys well between them, though there are others. The overall tone between the instruments is reputed to be slightly different, though I think for the B flat and A Clarinet it is subtle. By using transposition, the fingering system for the two interchangeable instruments could be kept the same and just scaled very slightly. This starting point of keeping similar fingering systems for different sized instruments in the same family has become more useful as more instruments have joined the family. (There are many common variants of most woodwind instruments).
One difference between woodwind and brass is that woodwind instruments will often be longer that their designated key might suggest to allow extra low notes. This is because the position of the holes, which are often left open, influences the pitch more than the overall tubing length.