If you are playing along with another instrument, it is essential that your guitar be in tune with that instrument. Tune the open strings of your guitar to the corresponding notes of the accompanying instrument. E.g., To tune to a piano, tune the open 6th string to the E note on the piano, as shown on the keyboard diagram. Then tune your guitar to itself from this note, using the method outlined below, or tune each string of your guitar to those notes of the piano shown on the keyboard diagram.
If you do not have another instrument to tune to, you can tune the guitar to itself by using the following method. However, this usually requires many months of practice. You will probably need your music teacher or musician friend to help you tune when you are learning.