The word whatever exhibits several grammatical properties. It can be used as an adverb, a conjunction, a determiner, or a pronoun.
As a relative pronoun
As a relative pronoun, whatever introduces a relative clause.
You may take whatever you like.
Whatever you do, I will always love you.
As a question pronoun
Whatever can introduce a question.
Whatever do you mean by being rude? (More emphatic than ‘What do you mean by being rude?’)
Whatever as a conjunction
As a conjunction, whatever connects two clauses.
We must stay united whatever happens.
Whatever means ‘it doesn’t matter what’.
Whatever happens, stay calm.
The same idea can be expressed using the expression ‘no matter what’.
We must stay united no matter what happens.
No matter what happens, stay calm.
Note that clauses with no matter what cannot act as the subject or object of another clause. Whatever is possible in this case.
You are free to do whatever you want. (NOT You are free to do no matter what you want.) (Here the clause ‘whatever you want’ is the object of the verb do. No matter what is not possible here.)
Whatever happened between us is none of your business.
Whatever can be used for saying that what happens is not important because it does not make any difference to a situation.
I will love him whatever he does.
Whatever can also be used for saying that you do not mind which thing is chosen.
‘What would you like to drink – tea or coffee?’ ‘Whatever. I don’t mind.’
Whatever can be used as an emphatic form of ‘what’.
Whatever do you mean by being rude to everybody? (= What do you mean by being rude to everybody?)
Whatever are you doing there? (= What are you doing there?)
Whatever happened to that 100 dollars you borrowed from me? (= What happened to that 100 dollars …)