Do we say the first generation of computers were or was invented? if the answer is (were), then why do we say the room of my brothers was built? generation is one thing.
It may become clearer if you rearrange the sentence.
Let's talk about generations of computers. The first was invented ...
The first anything is a single item, and a unique single item at that, hence the use of "the" as the article. Rearrange it again.
Let's talk about computers. The first generation was invented ...
Generation might be used as a collective term, but it describes one thing. There are multiple generations, so each generation is one example of a generation (singular). Back to your sentence:
the first generation of computers was invented ...
"of computers" doesn't change anything, it just identifies what we're talking about. There are lots of computers (plural), but there was just one first generation of them. If you want to talk about computers instead of generations:
Computers were invented ...
Computers is plural.
The first computer was invented ...
Computer is singular, and the first one is "even more singular". (Is that like "extra virgin" olive oil?)
Now it gets interesting:
The first computers were invented ...
First is singular and computers is plural. This is like the chameleon that exploded trying to hide in a box of crayons. Since computers is plural, we're not talking about the very first individual one. In this usage, we're really not even talking about one "first" computer, we're talking about many first computers.
These are the computers in the first generation. We can include the word "generation" if we want to talk about the entire collection as a single class. But what if we want to refer to the computers, themselves, rather than the class (the trees vs. the forest)? That's the context of "the first computers". So that usage is plural.
I think this is very similar to how we use the expression a number of something in English. The following is a perfectly grammatical example:
There are a number of things that I'd like to discuss with you.
In daily English, there are many times is substituted with there is. That pretty much has become the norm in spoken English. But the idea here is that we think of the first generation of something and a number of something as notions representing something that's made up of more than one thing. That's why, I think, you actually need a plural verb to go along with expressions like these.
We would say "The first generation of computers were invented", because generation is a collective term and refers to multiple things, therefore we use the plural were.
If you didn't need to specify computers in the sentence, perhaps because it was in a preceding sentence, you would also say "The first generation were invented, ..." just as you would also say, "The first computers were invented" but would say "The first computer was invented, ..."
We would say "the room was built" because the room is singular.
'Were' is the correct choice out of the two. However, it seems awkward to me to use 'generation' in this context A generation of computers is not invented in a group. Each computer is invented by itself. It's much clearer to leave the word 'generation' out and just say, 'The first computers were invented.'