In terms of the Greek text, the word for "Word," "Logos," is identical. Both verses have it as "λόγος" in the nominative masculine singular form.
The word for "beginning," "archē," differs only in its declension. In John 1:1 it appears as "ἀρχῇ" in the dative feminine singular form of the noun, whereas in 1 John 2:7 it takes the form "ἀρχῆς" which is the genitive feminine singular noun. This difference is purely a matter of grammatical usage, and does not change the word meaning.
The dative case indicates that the word is used as an indirect object. The genitive indicates possession or close association, e.g. "of the beginning."
The word "λόγος" (Logos) means simply "Word." The usage can apply broadly, indicating concepts such as a word, a saying, a message, a voice, or a speech. It can be used to encompass an idea or concept, a prophecy that is given, a commandment of God, a doctrine, a precept, or perhaps even "truth" in general (though it is not translated as "truth" anywhere in the New Testament).
According to BlueLetterBible, the KJV translates it as follows: AV — word 218, saying 50, account 8, speech 8, Word (Christ) 7, thing 5, not tr 2, misc 32.
There are over a hundred verses in the New Testament where this word is NOT translated as "word." Its meaning is broad and with broad application. Understanding the context is always important.