I am a beginner in chess. If I have only a king left, how many moves does my opponent have to mate me?
Your opponent has 50 moves, but every time a pawn is moved the count is reset. So, he could have hundreds of moves if he has a few pawns on the board. If he has no pawns, then 50.
The count is also reset if any piece or pawn is captured.
Do you mean "what is the minimum necessary number of moves?", or "what is the maximum allowable?"
Tony has already answered the second question - it could legally be thousands of moves depending on the position. As long as the same position is not reached more than twice and there is no 50 move stretch without a pawn move or capture, the game can go on until there are no pieces left. Theoretically, if you have lost all your pieces and he has lost none of his, he could jockey pieces around (making sure not to allow the same position three times) while every 50 moves moving a pawn or forcing you to capture a piece. The game could go on for over 3000 moves before it must end ([48 pawn moves + 14 captures] * 50 moves = 3100 moves). However, this scenario is extremely improbable, as a quicker mate would certainly be preferred.
As to the first question, if you only have a king, and your opponent has sufficient material to force mate, the minimum necessary number of moves in all positions would be 33 - in the case of King, Bishop, and Knight against King. In other cases, mate could be forced sooner. See Wikipedia again for a table: a queen takes at most 10 moves to mate with best play, a rook takes at most 16, two bishops 19, and bishop and knight (as mentioned) 33. (These are the only entries in the table with the opposing king as the sole defender.) Any other pieces or pawns added would reduce the necessary number of moves.