There is nothing about having your head shaved that could cause these kinds of symptoms. Theoretically, a razor could be faulty and could give you small electrical shocks, which would cause twitching. But you would also feel like you were being shocked, which you do not mention.
Therefore, it is much more likely that the twitching and fidgeting you experience is related rather to anxiety
provoked, for whatever reason, by the experience of having your head shaved. This is especially the case if you also experience sweating, your heart racing, blurry vision, or any trouble breathing (all signs of an anxiety or panic problem).
Sometimes, people will have anxiety in a social setting like a barber shop because of the close proximity with other people, which makes them nervous. Others will have anxiety when something is happening to them that they cannot control (such as someone else cutting their hair). Fortunately, it does not sound like you have these symptoms in any other setting, so the problem is not likely to be too serious for you. However, you may wish to discuss these symptoms with a psychiatrist
or a therapist
to determine if anxiety is an underlying problem and if it needs to be treated.