My teacher told me that I have to play trills with 3 fingers (3-2-1). Is he right? Can I play trills with 4 fingers (4-3-2-1)?
The sign tr denotes a trill. It doesn't denote a tremolo. With a trill, especially one as long as this, it can be played using the note written, and usually alternated with one a semitone or tone above, quickly. This can be done with two fingers, or 3 or 4, depending on the choice of the player. The note shown could be a C or C#, thus giving a choice between alternating black/white keys, or white/black keys, or even white/white, or black/black.
A tremolo is rather different, but that doesn't need discussing here, except to say that's not what's expected here.
While the music pictured indicates a trill, we can discuss one-handed tremolo on piano. I agree with your teacher, assuming we are using different finger numbers.
There are some very quickly repeated notes in some pieces that have to be played with one hand. I'm thinking of "Samuel Goldenberg and Schmuÿle" from Pictures at an Exhibition, primarily. In that case, yes, using multiple fingers from one hand is the best way.
There is a good reason not to use the thumb (1st finger, in the numbering I'm familiar with) nor the pinky (5th finger) when playing rapidly repeated notes. Especially with the 5th, it is usually shorter and weaker and it would be much more difficult to play quickly and evenly with that as one of the fingers. The thumb is not only a different size but is also articulated very differently, again making it a challenge to play quickly and evenly.
The technique I was taught was to use fingers 2, 3, and 4 (index, middle, and ring) and to use them in reverse order, meaning 4-3-2-4-3-2-etc. In the piece mentioned above, I finger it 4-3-2-2-(2-3-2). The first four notes are quickly repeated playing of one key, and then the (2-3-2) is a little ornament at the end with the 3 being used for the next higher note.
If the OP's question really is about a trill, then short trills are often played using just two fingers on the alternating notes. But on a long trill it is often less tiring to use fingering like 1 3 2 3 1 3 2 3 1 3 2 3 ... rather than 2 3 2 3 2 3 2 3 2 3 2 3 ... or variations on this idea 1 3 1 3 1 3 1 3 2 3 2 3 2 3 2 3 1 3 1 3 1 3 1 3 ... or 1 3 2 3 2 3 2 3 1 3 2 3 2 3 2 3 ...
You can use similar fingering for playing fast repeated notes. If the notes are triplets, use 3 2 1 3 2 1 3 2 1... Maybe that is what your teacher was meant by "3-2-1 fingering".
4-3-2-1 is possible, but using four fingers means your hand and arms have to move around more than using two or three, so you don't necessarily gain anything.
It doesn't get much better than this demo of how to do it...