It's not if you imagine that every word in a sentence is a friend, and all friends need to agree (from Latin concordare, "toagree") with each other in order to have fun.
That's lame.
Well then, I'll explain it in the traditional way. Remember how every noun has a gender in Spanish and that it's important for the article?
El sombrero, la siesta, yes!
As it turns out, the noun bosses around a bunch more members in the sentence. We have seen that masculine nouns call for masculine articles and if the noun is plural, we need the plural masculine article. This applies to adjectives, too. Adjectives will change their endings to go with the nouns!
Wait a second, what's an adjective again?
It's a word that describes things.
Masculine endings:
El perro gordo.
The fat dog.
Los gatos delgados.
The thin cats.
Feminine endings:
La oficina pequeña.
The small office.
Las mesas blancas.
The white tables.
What happens if we have two nouns? Like "the white table and the white chair"?
Good question! If you have two nouns or more, you need the ending for plural. But the gender... well, that will depend.
If the nouns have the same gender:
La mesa y la silla blancas.
The white table and the white chair.
El conejo y el gato negros.
The black rabbit and the black cat.
If the nouns have different genders:
La manzana y el plátano maduros.
The ripe apple and the ripe banana.
Macho endings!
Yeah, well, not all adjectives go down that path. Some are politically correct and always stay the same. Please never say: La casa verda or El cielo azulo.
La casa verde.
The green house.
El árbol y la casa verdes.
The green tree.
Here's a list of all gender-neutral adjectives you should know: