Geometrical origin of gauge theories